62.2k views
1 vote
Fill in the blank
method overloading distinguishes between methods based on _____.

1 Answer

6 votes

Final answer:

Method overloading distinguishes between methods based on their parameter types or number of parameters in a class.

Step-by-step explanation:

Method overloading allows you to differentiate between methods according to the kind of parameters they take or how many there are in a class. It permits the coexistence of several methods with the same name but distinct parameter lists.

For example, in Java, you can have two methods named 'calculateArea' in a class, where one takes the radius of a circle as a parameter and the other takes the length and width of a rectangle as parameters. The compiler determines which method to call based on the arguments passed.

User Gary Elliott
by
8.2k points