• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

protected class

 
Jammy Wells
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why a class cannot be protected?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
jim xu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic