|
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 VariablesFor primitive types, also, the == operator looks only at the variables. For example:
In this code, also, 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? Click Here after you have answered the question |