Computer Scientists are Pretty Pessimistic

Wednesday 22 June 2016

Access Specifiers In Java

There are four types of access specifiers in java : -

1. Anything declared public can be accessed from anywhere.

2. Anything declared private can not be seen outside of its class.

3. Anything declared as default access (package private) can be accessed from anywhere in the same package.

4. Anything declared as protected can be accessed from anywhere in the same package plus from only its sub classes outside the package. 

No comments:

Post a Comment