3.7 Comparing Objects

Enduring Understanding

The way variables and operators are sequenced and combined in an expression determines the computed result.

Learning Objective

Compare object references using Boolean expressions in program code.

Essential Knowledge

Two object references are considered aliases when they both reference the same object.

Object reference values can be compared, using == and !=, to identify aliases.

A reference value can be compared with null, using == or !=, to determine if the reference actually references an object.

Often classes have their own equals method, which can be used to determine whether two objects of the class are equivalent.

Last updated

Was this helpful?