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.");
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 the variables contain object references.
(Thought Question: ) Could two different objects contain equivalent data?