Import com. Sun. xml. Internal. ws. server. serverrtexception;
/**
* An object is a direct or indirect parent class of all objects.
* All objects are defined in this class.
* Created by rabbit on 2014-07-29. Blog garden. Liu pengcheng
*
*/
Class demo111
{
}
* Created by rabbit on 2014-07-29. Blog garden. Liu pengcheng
Public class objectdemo {
Public static void main (string [] ARGs)
{
String S1 = new string ("123 ");
String S2 = new string ("123 ");
Demo111 d1 = new demo111 ();
Demo111 D2 = new demo111 ();
D1 = d2;
System. Out. println (s1.equals (S2); // true because they all have the same 123 Value
System. Out. println (S1 = S2); // false because their memory addresses are different. Note:
// The comparison method has been rewritten.
System. Out. println (d1.equals (D2 ));
System. Out. println (d1 = d2); // both results are true because they call
// The methods in the object, equals and = are
} // The same is true for memory addresses.
}