Originally posted by Tom House:
I don't understand why it 'doesn't make sense' to modify a top level class with the protected access modifier.
why does it make sense for classes to be accessible to other classes in the same package only (default) but not to other classes in the same package and subclasses in other packages (protected)?
can somebody please explain?
Be careful with that statement.
but not to other classes in the same package and subclasses in other packages (protected)? Ok suppose
Java allows top level class to be protected. What will you use it for. It becomes public access modifier only.
If suppose you make a class as protected then only the classes that subclass this class will be able to use it which in turn means that this class has to be public so that any class in any other package can see it and hence subclass it.
Think deeply man, its a thin difference!!!