Access Modifiers

control how much of an object is visible to the rest of Java program, and packages provide the highest level of control over object visibility.

private - accessible to the classes only.
protected - accessible to class, package, and subclasses
[default] - accessible to the class and package
public - accessible to global

Can we define private and protected modifiers for variables in interfaces?

Having private or protected members in an interface doesn't make sense conceptually.

results matching ""

    No results matching ""