Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Harry Hunter   on Apr 15 In Java Category.

  
Question Answered By: Lughaidh Fischer   on Apr 15

i m not too clear wht u r asking in ur example..

but genrally in "private" access  level, the same
object have access to all the methods  & variables
eventhough it's private. but outside the class  the
other class can't access a private  member.

"protected" access level, the child (extending) class
has access to all the protected  members if it's in a
SAME PACKAGE. but if the extending child class is in
different package they can't access parent's protected
member but still they can use their own version of
protected members (child.xxx())

"public" access level will allow full access to the
same class, a class in same package, a class in
different package. (means no restriction)

for more information plz check the following link:-

java.sun.com/.../accesscontrol.html

Share: 

 
 
Didn't find what you were looking for? Find more on Java access modifiers Or get search suggestion and latest updates.


Tagged: