== operator looks only at the variables.
==Looks only at Variables
For primitive types, also, the
operator looks only at the variables.
int x = 32; int y = 48; if ( x
==y ) System.out.println("They are equal.");
The contents of the variables
But with primitive types, the contents of a variable is the data, so with
== looks at data.
With reference types,
looks at the contents of the variables,
but the variables contain object references.
(Thought Question: ) Could two different objects contain equivalent data?