More about Objects and Classes
20. alias-detector
Answer:
The two variables refer to the same object
alias-detector
The ==
operator looks only at variables. If two variables contain a reference to the same object, the operator evaluates to true.
Think of the ==
operator as an alias-detector.
Question 20:
(Thought question:) Could the equals()
method be used with aliases?