• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why cannot use protected in this class definition?

 
Megan Lion
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
protected class Fred{
private int x=0;
private Fred(int xval){
x=xval;
}
}
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic