Referenceequals () determines whether two strings point to the same memory address;
Equals: first, if two strings have the same memory location, the two strings are equal. Otherwise, the two strings are compared by character to determine whether they are equal.
The following is an example:
String peom1 = "Kubla Khan"; <br/> string peom2 = "Kubla Khan"; <br/> string peom3 = string. copy (peom2); <br/> string peom4 = "Kubla Khan"; </P> <p> // referenceequals () determine whether two strings point to the same memory address <br/> console. writeline ("peom1 = peom2:" + (peom1 = peom2); // true <br/> console. writeline ("peom1 = peom3:" + (peom1 = peom3); // true <br/> console. writeline ("referenceequals (peom1, peom3):" + referenceequals (peom1, peom3); // false </P> <p> // equals, first, determine whether two strings have the same memory location, then the two strings are equal; otherwise, compare the two strings by character to determine whether they are equal <br/> console. writeline ("Equal (peom1, peom3):" + String. equals (peom1, peom2); // true <br/> console. writeline ("Equal (peom1, peom3):" + String. equals (peom1, peom3); // true