A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

What is the difference between a class and a public class?

Best Answers

A class may be declared with the modifier public, in which case that class is visible to all classes everywhere. If a class has no modifier (the default, also known as package-private), it is visible only within its own package (packages are named groups of related classes). read more

Public means that the subject may be accessed by any class, protected by subclass, private by the class itself, no modifier means "package protected", so the subject may be accessed by classes from the same package. read more

A public class has "public" visibility, which means that it is accessible to any class in any package, while a class has "default" or "package" visibility, i.e. the class is accessible only to classes inside the same package. read more

Encyclopedia Research

Wikipedia: