Beginners To learn Java, is javase, every day I learn from the day and notes, I hope you can criticize and advice, and promote common progress! Eighth Day!

Source: Internet
Author: User
  1. Polymorphism (polymorphism): The multiple manifestations of a certain class of things. (The reference of a parent type to a reference to a subclass type, or to an object of subclass type), greatly improves the extension of the program. The prerequisite for polymorphism must be that the class has a relationship with the class, either inherited or implemented. There is usually a premise that there is coverage. Polymorphism also has drawbacks, although extensibility is provided, but members in the parent class can only be accessed using a reference to the parent class.
  2. In polymorphism, you can refer to the object of the parent class (Animal a = new Cat ();) This is a type promotion, and next, you can also cast the parent class's reference to the type of the subclass (car c = (car) A;) However, it is wrong to convert the parent class object to a subclass type (Animal A = new Animal (); Cat C = (Car) a).
  3. instanceof Keyword: The object that determines whether an object is a class.
  4. The characteristics of member functions in polymorphism: At compile time, see if there is a method called in the class to which the referenced variable belongs. If there is, the compilation passes, and if not, the compilation fails. At run time, see if there are methods called in the class to which the object belongs. The simple summary is: the member function in polymorphic call, compile look to the left, run look to the right.
  5. The characteristics of member variables in polymorphism are referred to the left (the class to which the reference variable belongs)
  6. In polymorphism, the characteristics of static member functions, both compiled and run, are referred to the left.
  7. Object class: Is the direct or indirect parent class for all objects.

Beginners To learn Java, is javase, every day I learn from the day and notes, I hope you can criticize and advice, and promote common progress! Eighth Day!

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.