+ 2
What is the difference between starting a code with (Class My class ) *for example* and ( Public class program)
format
2 Antworten
+ 2
For what I know, if you make a class without putting any access modifier, ie public in your example, in Java makes the class default. Java default classes can only be accessed within the same package while public classes are accessible from any packages.
+ 1
With public keyword, class becomes accessible for other classes.