Java Access Modifiers

The access modifiers in java specify accessibility (scope) of a data member, method, constructor or class.

There are 4 types of java access modifiers:

private
default
protected
public

1. The private access modifier is accessible only within the class.
2. The default modifier is accessible only within the package.
3. The protected access modifier is accessible within the package and outside the package but through inheritance only.
4. The public access modifier is accessible everywhere. It has the widest scope among all other modifiers.

Please email us at online.nimit@gmail.com if you need any further information.

Leave a Reply

Your email address will not be published. Required fields are marked *