Home >Java >Javagetting Started >What is the difference between overloading and rewriting in java

What is the difference between overloading and rewriting in java

王林
王林forward
2020-04-30 17:11:362727browse

What is the difference between overloading and rewriting in java

Difference:

Method overloading is a class that defines multiple methods with the same name, but the number of their parameters is different or the number is the same but the type and order are different. .

Method overriding is a method in which the method in the subclass has the same name as the method in the parent class, and the number and type of parameters are the same, and the return value is also the same.

(Recommended video tutorial: java video)

As shown below:

What is the difference between overloading and rewriting in java

Recommended tutorial: Java entry program

The above is the detailed content of What is the difference between overloading and rewriting in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete