A String
1.equals (): String objects or equal to two equal content recommendation
String a=new String("abc"); String b=new String("abc"); a.equals(b);
2. = =: compare Address
String c="123"; String d="123"; System.out.println (C == D); // to true, the value in the java string is not altered, the same string will keep a copy in memory, so the points a and b are the same objects;
String a=new String("abc"); String b=new String("abc"); System.out.println (C == D); // to false, a and b at this time point to a different object.
= = Is more memory addresses, memory addresses are equal, it returns true, equal address, definitely value too, addresses are not equal, even if the values are equal will return false,
String object type, it is not a simple "==" is determined.
The use equals () method, String override the equals, regardless of whether the same address, only compare values, the values are equal returns true, not equal returns false.