It is because, the protected method becomes private to classes that try to subclass only in the same package. When you subclass in another package, then the protected member is still available.
See the below coding where it contradicts..
All the above three classes in the same package p1. Class3 can able to access the protected method in Class1..
To Henry Wong:
A protected method is accessable by any subclass, not just classes that directly inherit from it. Since ClassThree is a subclass of ClassOne (albeit not directly), it can access the protected methods.
As per quotes, a protected method will be accessible by any sub class(which extends it) regardless of same/different packages...
When a protected method will not able available / become private? can u modify my above coding to suit it?
Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT