Dave
'protected' is a strange beast JLS �6.6.2 states:
quote:
--------------------------------------------------------------------------------
6.6.2 Details on protected Access
A protected member or constructor of an object may be accessed
from outside the package in which it is declared only by code
that is responsible for the implementation of that object.
--------------------------------------------------------------------------------
Which basically means that the subclass can only access the protected members of the superclass if it actually creates and uses the superclass member. You can't just pass a superclass object to one of it's methods.
Dave
Sun Certified J2EE Architect for the J2EE Platform (Part 1)<br />Sun Certified Web Component Developer for the J2EE Platform<br />Sun Certified Programmer for the Java 2 Platform
The second comparison should be true though, because it is comparing primitives (by value).
SCJP2. Please Indent your code using UBB Code
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|