Showing posts with label protect. Show all posts
Showing posts with label protect. Show all posts

Tuesday, 21 January 2014

Introducing access controls in java

how to specify access specifiers: public: private: protect

Access control:


 Encapsulation links data with the code that manipulates it. However,encapsulation provides another important attribute: access control.Java’s access specifiers are public, private, and protected. Java also defines a default access level.protected applies only when inheritance is involved. When a member of a class is modified by the public specifier, then that member can be accessed by any other code.