In Java, the == operator is used to compare the references of two objects to see if they point to the same object in memory.