Overloading and rewriting--NOTE 2

Source: Internet
Author: User
A 1.java rewrite means that a method of a parent class is redefined  in a subclass, and its subclass has the same method name and parameter position and number as the parent class, so that when the method of the subclass is called, The method of the parent class is not executed. If the method is defined in the parent class as final, it cannot be overridden in a subclass.

2. Each Java class has its own constructor, and the constructor method is characterized by the same method name as the class name, which can be overloaded .

PS. The concept of overloading means that in the same Java class, there are two or more than two methods of the same name, but the number and position of the parameters are not exactly the same. For example, GetName () and getName (int index) are overloaded relationships.

Overloading and rewriting--NOTE 2

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.