In the new program, did the == operator look at the contents of the object?

A good answer might be:

No. The == operator looks only at the variables.


== Looks only at Variables

For primitive types, also, the == operator looks only at the variables. For example:

int x = 32;
int y = 48;

if ( x == y ) System.out.println("They are equal.");

Only the contents of the variables x and y are examined. But with primitive types, the contents of a variable is the data, so with primitive types == looks at data.

With reference types, == looks at the contents of the variables, but now the variables contain object references.

QUESTION 16:

(Thought Question: ) Could two different objects contain equivalent data?