Each object has an address hash value in memory, and this hash value is hexadecimal
Calls the Hashcode () method of the Object object, returning the hash value of this object
Call the Integer.tohexstring () method to convert the hexadecimal
Call the object's ToString () method to get: Class name @ hash value
Usually we will make a copy of the ToString () method because the default does not mean much
The principle of implementation is the reflection of the class
When we create an object, a Xxx.class file is generated on the hard disk, and the JDK defines class classes to describe these class files
Call the Object object's GetClass () method to get the class object
Call the GetName () method of the class object to get the name of the class
public class Objectdemo {
/**
* @param args
*
/public static void main (string[] args) {
Objectdemo od =new Objectdemo ();
System.out.println (Od.tostring ());//Output objectdemo@26f04d94
System.out.println (integer.tohexstring ( Od.hashcode ());//output 26f04d94
//Reflection
Class c=od.getclass ();
System.out.println (C.getname () + "@" +integer.tohexstring (Od.hashcode ()));
}
The above discussion of Javase object-oriented objects (object class ToString) is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.