JAVA--API Documentation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.