Nate Sedler :
I'm taking AP Computer Science this year and my teacher says to use public class Main
opposed to just class Main
. When we asked her why not class Main she said that's just how AP Computer Science does it and didn't elaborate on it at all.
ItFreak :
It is about how your class can be accessed. Using only class Main
, the class can only be accessed from inside her package and the class self. Using public class Main
, the class can be accessed from anywhere.
You can read more about modifiers at the javadoc:
https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html