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
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|