It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Protected Outer Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Protected Outer Class" Watch "Protected Outer Class" New topic

Protected Outer Class

Vrushali Gore
Ranch Hand

Joined: Oct 17, 2005
Posts: 40
Why my Outer class can't be protected
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
What do you want to protect it from?

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Matt Russell
Ranch Hand

Joined: Aug 15, 2006
Posts: 165
I presume you're asking why top-level classes can't be marked "protected"?
In that case, I've two questions: 1) what does the "protected" modifier do for you when you use it for fields and methods of a class? 2) What would you expect would be the result of marking a top-level class "protected" in terms of its visibility? Does the idea still make sense?

Inquisition: open-source mock exam simulator for SCJP and SCWCD
I agree. Here's the link:
subject: Protected Outer Class
It's not a secret anymore!