This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes protected key word Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "protected key word" Watch "protected key word" New topic

protected key word

Sanath Ramesh kumar

Joined: Mar 13, 2012
Posts: 4
Why cant protected access specifier could be given to a top level class even though it comes second in the hierarchy(1.public 2.protected 3.default 4.private).It is allowed to use default though it stands 3rd in the hierarchy??
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Please, SearchFirst
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114

I'll ask you a question back which will make clear why you can't make a top-level class protected: What do you think it would mean if a top-level class is protected?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
I agree. Here's the link:
subject: protected key word