In java program, it’s not crucial a class to be a public class.Meanwhile in a single java file there can be several classes defined and among them there can be only one class to a public class.

lets take an example…

This implies that If there is a public class in a java file the file should be named as

<public Class name>.java

Tech enthusiast…</>

Tech enthusiast…</>