import java.io.*;
class a{}
class b{
public static void main (String[] args) {
System.out.println("Geeks..");
}
}
If in above snippet,
I make class b as public, it gives compiler error:
class b is public, should be declared in a file named b.java
Why it then doesn't expect main in class a after making b as public?
I make class a as public,it again gives : main not found in class A.
If I make both classes public, it gives: class b is public, should be declared in a file named b.java
If I change it to below:
public class b{ public static void main (String[] args) { System.out.println("Geeks.."); } } class a{}
It gives proper output: Geeks..
Please clarify the relation between order of classes, public and non public class, main method and file name.