This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes access modifier?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "access modifier??" Watch "access modifier??" New topic
Author

access modifier??

srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252
1)If no accessibility modifier (public, protected and private) is given in a member declaration of a class, the member is only accessible for classes in the same package and subclasses of the class

here is it false because of the condition of satisfying both (i.e same package and any subclass)..


simple doubt ...

thanks

sri


Thanks & Regards<br /> <br />-Srikanth
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

here is it false because of the condition of satisfying both (i.e same package and any subclass)..

Correct.
Seb Mathe
Ranch Hand

Joined: Sep 28, 2005
Posts: 225
I think question is ambigous :

1)If no accessibility modifier (public, protected and private) is given in a member declaration of a class, the member is only accessible for (classes in the same package) and (subclasses of the class)
-> true

1)If no accessibility modifier (public, protected and private) is given in a member declaration of a class, the member is only accessible for classes (in the same package and subclasses of the class)
-> false


Regards,<br />Seb<br /> <br />SCJP 1.4
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

1)If no accessibility modifier (public, protected and private) is given in a member declaration of a class, the member is only accessible for (classes in the same package) and (subclasses of the class)
-> true

That's false, unless there's some definition of *and* I'm not considering. It can't be *and*, because the set of subclasses includes those that are not within the package, which of course do not have access to default members of their supertypes. Can you describe further what you found ambiguous?
 
jQuery in Action, 2nd edition
 
subject: access modifier??
 
Similar Threads
class level access modifier
what is a package?
Which situations are possible the use of transient, synchronized, native and protected modifiers?
Confused with protected access
why this code gives compiler error.