At the time of comparison, "==" and "Equals (Object)" are often used. They often let beginners feel puzzled. Let's take an example of public class example {public static void main (string [] args) {string S1 = new string ("abc"); string s2 = new string ("abc"); // s1 = s2; system. Out.println ("Use == Comparison Results"); system.out.println (S1 == S2); // false}} Since the two String object content is "ABC" why False first. It is because "==" is more than two objects, not their content, how can I compare whether the content is equal? The comment result of the S1 = S2 sentence is different because their reference is the same. We want to use the equals (object) method, because the equals (object) method is the method defined in the Object class, and the class defined by default is its subclass. That is to say, the Object class is a super class of all classes (Super Class, also called parent class, base class, etc.), and the equals (object) method in Object is the standard form for public boolean equals (object obj). Boolean, TRUE / FALSE is the same as "==". The equals (object) method defined in the object class is to use both objects of "==" comparison, so if there is no override (Override, or rewritten, rewriting) Equals (Object) method, Equals (Object) As a reference to "==". Such an example (result in the comment): public class example4 {public static void main (string [] args) {example4 E = new example (); example4 e4 = new example4 (); system.out.println ("with Equals Object) Comparison Results "); System.out.Println (E.Equals (E4)); / / The result is false system.out.println (" == comparison result "); system.out.println (e == E4); / / The result is a special thing compared to "==". Of course, the JDK also has classes that override the equals (object) method, such as java.lang.string, which covers the equals (object) method inherited from Object to compare the contents of the string.