go to previous page   go to home page   go to next page hear noise

What is the output of the program?

Answer:

The two variables refer to the same object


alias-detector

two variables, both pointing at the same object

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?


go to previous page   go to home page   go to next page