Overloading in Java

Source: Internet
Author: User

(1) method overloading is a means of allowing classes to handle different types of data in a uniform manner. Multiple functions with the same name exist at the same time, with different number/types of parameters.

Overloaded overloading is a representation of polymorphism in a class.

(2) Java's method overloading is the ability to create multiple methods in a class that have the same name but have different parameters and different definitions.

The method is called polymorphism by the number of different arguments passed to them and by the type of parameter to determine which method to use.

(3) When overloading, the method name is the same, but the parameter type and number are different, the return value type can be the same or different. The return type cannot be used as a distinguishing criterion for overloaded functions.

In the actual test, it is found that, as the 2nd overloading occurs, depending on the number of arguments passed to method and the parameter type to determine which method to use, when the return type is the same and the number of parameters and the type can not be compiled and run.

Overloading 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.