Sun Download jdk--extract--javadoc file (Constuctor summary[constructor Method]+method summary[method])
"Object"
the object class is the root class for all Java classes. ----Clone ();----equals (Object o); ----Finalize ();----getclass ();----hashcode ();----Notify ();----Notifyall ();----toString (); "ToString Method"Public String toString (); The return value is of type string----Official documents recommend overriding this method for all classes----Default implementation is: GetClass (). GetName () + "@" + integer.tohexstring (Hashcode ());<1> When a string is connected to another type of data, such as System.out.println ("A:" +a), the ToString method of the object class is automatically called. System.out.println ("A:" +a) =system.out.println ("A:" +a.tostring ()) "Hashcode Method"The JVM needs to find the address of an object in memory at run time, and we use a table to record the location of the object, which is typically hashed (each object has its own unique hash code that uniquely identifies the object and its location). "Equals Method" Note: Differentiate address comparisons from value comparisonsa = new A ();b b = new B ();System.out.println (a=b);//The address is compared here (new two objects cannot be equal)System.out.println (a.equals (b));//This will still return false, its implementation is still not a value comparison, you should override the Equals methodPublic Boolean equals (Object obj) {
if (0BJ = = null) return false;
else{
if (obj instanceof A) {
a = (a) obj;
if (a.*==b.*) {//Compare Properties
return true;
}else{
return false;
}
}
}
}
JAVA--API Documentation