Prev Next

Java / Modifiers

Types of access modifiers.

There are four access modifiers in Java.

private.

Private members are visible only inside the class in which they are defined.

protected.

Protected members of a class are visible within the package but they can be inherited to sub classes outside the package.

public.

public members are visible universally.

default or No-access modifier.

Members of a class which are defined with no access modifiers are visible within the package in which they are defined.

More Related questions...

Show more question and Answers...


Comments & Discussions