Just one object (and three reference variables, each referring to it.)
equals( String ) method of class
String tests if
Strings contain the same characters.
equals( String ) method looks at objects.
It detects equivalence. The
operator detects identity.
String strA; // first object String strB; // second object strA = new String( "The Gingham Dog" ); strB = new String( "The Gingham Dog" ); // check for equivalence if ( strA
In this example, there are two objects.
Each object has its own identity,
and its own unique reference,
Each object contains equivalent data,
equals() returns true.
If you made a photocopy of a sheet of paper, you would have two sheets of paper.
==the second sheet?
equals()to the second sheet?