LATEST UPDATES

Friday 18 November 2016

What are the various access specifiers for Java classes?

1. Public : Class,Method,Field is accessible from anywhere.
2. Protected:Method,Field can be accessed from the same class to which they belong or from the sub-classes,and from the class of same package,but not from outside.
3. Default: Method,Field,class can be accessed only from the same package and not from outside of it’s native package.
4. Private: Method,Field can be accessed from the same class to which they belong.

No comments:

Post a Comment

Designed By Blogger Templates