+ 2

What is the difference between starting a code with (Class My class ) *for example* and ( Public class program)

format

8th Mar 2018, 6:48 AM
Ereik Kimkim
Ereik Kimkim - avatar
2 Réponses
+ 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.
8th Mar 2018, 7:40 AM
Andy Tan
Andy Tan - avatar
+ 1
With public keyword, class becomes accessible for other classes.
8th Mar 2018, 6:50 AM
Sad
Sad - avatar