Why filename.java should be same as public class name declared inside java file. Why this convention is followed
and also...why cant we declare class as a private or protected.
As for question one don't question the language layout, it's not our issue..
Question2: Read up on this matter urgently as it's related to some of the security features of Java.
SCJP 6.0, SCJD (400/400), SCBCD for JEE 5, SCWCD 1.4 I do videos for development at
I am probably the only developer ever to have had an orange sized brain tumor in my brain while learning development!!
To be precise, because JAVA specifications say this .
and to be specific now, Why would any language make it difficult to find your source for absolutely no benefit by allowing arbitrary file/class naming?
public class is entry point for the JVM (which in turn help compiler to compile dependencies.).
private and protected classes are allowed but only as inner classes.