Java Foundation Easy to point summary (i)

Source: Internet
Author: User

Subclass inherits parent class represents sub-analogy his parent class contains more information and methods

When a subclass calls an overloaded construction method, it calls the constructor of the parent class, Super (); it is generally called implicitly if it is not written, and each call is preceded by all statements.

In a function, a subclass can be used where the parent class is used, which is often said to be polymorphic, the actual type of the variable is the actual class of the object referenced by the variable, and the function called by the variable is determined by the actual class of the variable, which is called dynamic binding.

such as: Object o =new int (); O.tostring () calls the ToString () method of int, and if the actual class does not have the method, find out if the method is available to his parent class until it is found.

instanceof Ensure that the object is in the target class, usage: if (object instanceof Circle) {};

Java Foundation Easy to point summary (i)

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.