File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes protected class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "protected class" Watch "protected class" New topic

protected class

Jammy Wells

Joined: Oct 04, 2007
Posts: 17
why a class cannot be protected?
marc weber

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Jammy Wells:
why a class cannot be protected?

A class can be protected if it's nested.

As to why a top-level class can't be protected... What would this mean?

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
jim xu

Joined: Nov 18, 2007
Posts: 6
In terms of the class member, protected means only the inherited classes can see those members. The package access for class is somewhat like that. Only classes inside the same package can see that class. So can we treat the default 'package access' for a class like a 'protected' class?
I agree. Here's the link:
subject: protected class
jQuery in Action, 3rd edition