Monday, April 07, 2025

LATEST UPDATES
>> What is the difference between continue and break statement?  >> What is a singleton class? Give a practical example of its usage.  >> What’s the purpose of Static methods and static variables?  >> What are the various access specifiers for Java classes?  >> What is the difference between an Inner Class and a Sub-Class?    

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 Seo Blogger Templates