Java's base class object
Java's JDK documentation is frequently consulted, and it is best to view documents in English.
-
Java.lang.Object class, Java.lang package in use without displaying the import, compile-time by the compiler automatically help us to import.
-
API (Application Programinga Interface), application programming interface.
-
Object obj = new Object ();
System.out.println (obj);
System.out.println (Obj.tostring ());
The two items printed above are the same. When you print a reference, you actually print the return value of the toString () method that references the object you are pointing to, because each class is directly or indirectly inherited from object, and ToString () is defined in the object class, so each class has the ToString () method.
-
String str = "AAA";
System.out.println (str);
System.out.println (Str.tostring ());
Two outputs are AAA, according to the above understanding, sting must rewrite the toString () method of object.
-
Base class for Java record -22-java object