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 key word Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
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: 15092

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 8 API documentation
I agree. Here's the link:
subject: protected key word
It's not a secret anymore!