The difference between overloading and overriding methods in Java

Source: Internet
Author: User
Overloading and overriding methods in Java

1) The parameter of the method: the overloaded method and the source method will change in the order of the parameter list, and the overridden method will not change the order of the parameter's data type and the parameter list.

2) Whether the original method is overridden: The overloaded method does not overwrite the original method, and the overridden method overrides the method in the parent class, and invokes only the overridden method.

3) on the object that invokes the method: When the overloaded method is called, the calling object is not the same, the calling method is different, the result is different, and the overridden method is invoked, regardless of whether the object being called is the parent or subclass object, the same method is produced, and the result is the same

The difference between overloading and overriding methods in Java

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.