java foundation of Object

Object class is the root class hierarchy (parent) class. 
Each class (Person, Student ...) uses the Object as super (parent) class.
All objects (including arrays) are implemented method of this class.

Object class toString method without rewriting the target address value is printed, the print object attributes need to be rewritten

equals method of Object class, is not rewritten, the address comparison values, the comparison object may override properties
Object obj: any object can pass 
== comparison operator, returns a Boolean true false
basic data types: comparing the value of
reference data types: two parity value is the address of the object

Objects class equals method: comparison of the two objects to prevent the null pointer exception (instead of the above process)

format:

 

 

 
 
 
 

Guess you like

Origin www.cnblogs.com/suitang/p/11628260.html