Tag: access-modifiers

What is the difference between public, protected, package-private and private in Java?

The Question : 3270 people think this question is useful In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with inheritance? The Question Comments : private hides from other classes within the package. public

What is the difference between public, protected, package-private and private in Java?

The Question : 3270 people think this question is useful In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with inheritance? The Question Comments : private hides from other classes within the package. public