Four Access Levels
For Java modifiers, the following table should be clear enough.
|Modifiers||Current Class||Same Package||Subclass||Other Package|
- Methods declared public in a superclass also must be public in all subclasses.
- Methods declared protected in a superclass must either be protected or public in subclasses; they cannot be private.
- Methods declared private are not inherited at all, so there is no rule for them.
- The fields in an interface are implicitly public static final and the methods in an interface are by default public.