Object.toString () method returns the hexadecimal address

First Source Object

public String toString() {
        return getClass().getName() + "@" + Integer.toHexString(hashCode());
    }

Question: Why should hashCode () converted to hexadecimal.
A: hashCode () method returns the address of the object in memory, is represented by ×××.
1. The memory address is usually represented by a hexadecimal in the computer industry, some people might ask, the conversion process will not cause loss of performance. By toHexString () source term, all calculations are calculated using the binary method, and the impact on performance is not a binary computing.
2. Another object, toString () method returns the value of a combination of "+ @ + fully qualified name address", the aim is to debug we can uniquely distinguish one object from the address converted to hexadecimal 10 hex easier for us humans to recognize.

Guess you like

Origin blog.51cto.com/3544011/2429456