I have a file Test.java
and the following code inside it.
public class Abcd
{
//some code here
}
Now the class does not compile, but when I remove the public
modifier , it compiles fine.
What is the reasoning behind Java allowing us to compile a class name that is different from the file name when it is not public.
I know it is a newbie question, but I'm not able to find a good explanation.