permaculture playing cards*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes why cannot use protected in this class definition? 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 "why cannot use protected in this class definition?" Watch "why cannot use protected in this class definition?" New topic
Author

why cannot use protected in this class definition?

Megan Lion
Greenhorn

Joined: Mar 02, 2002
Posts: 7
protected class Fred{
private int x=0;
private Fred(int xval){
x=xval;
}
}
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
top-level classes cannot be protected or private.
See JLS 8.1 Class Declaration for detailed information about which modifiers are legal and which are not.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: why cannot use protected in this class definition?
 
Similar Threads
why cannot use protected in this class definition?
Access Modifiers
inner class
inheritance and variables
///private constructor///