in java, filename should be same as that of main class. It is the way of telling compiler that this is the entry point for you. but why this thing works:
class xyz{
public static void main(String[] args){
System.out.println("a");
}
}
even when saved with different filename.
And why this thing does not when saved with diffrent filename:
public class xyz{
public static void main(String[] args){
System.out.println("a");
}
}