Java Access Modifiers

Four Access Levels

For Java modifiers, the following table should be clear enough.

Modifiers Current Class Same Package Subclass Other Package
public Yes Yes Yes Yes
protected Yes Yes Yes No
default Yes Yes No No
private Yes No No No


  • 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.