Access Modifiers for Classes


The public keyword appears in almost all of our examples:
     public class MyClass { ... }
It is an access modifier, which is used to set the access level for classes, attributes, methods, and constructors. They are divided into two groups: Access Modifiers for Classes
For classes, you can use either public or default:

Modifier Description
public The class is accessible by any other class.
default or nothing The class is only accessible by classes in the same package. This is used when you do not specify a modifier.

The public Keyword for Classes
A public keyword is an access modifier. It can be assigned to variables, methods, constructors, and classes. It is the most non-restricted type of access modifier.


      Beauty is only skin deep.