Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Nitesh Nandwana wrote:Java class can be public and default, whereas it cant be private because it'll be useless but why it'cant be protected.I don't believe in rules although i believe in reason, please satisfied me .
Inner classes can be protected. Only classes in the same package and subclasses of the outer class in different packages would then be able to access the protected inner class.
Stephan van Hulst wrote:If a member is protected, it means that subclasses of its enclosing class can access it. But a top level class doesn't have an enclosing class, so protected makes no logical sense.
thanks but can you clear it?
Suppose in a package there are two classes ,first class has protected access modifier and second one has default now i try to extend second class ok ? now what is theoretically illegal in it ? because both is in same package and because of protected access modifiers of superclass it should allow to access its member to subclass ,there shouldn't be any problem