169k views
5 votes
An overloaded method consists of,

(a) The same method name with different types of parameters
(b) The same method name with different number of parameters
(c) The same method name and same number and type of parameters with different return type
(d) Both (a) and (b) above
(e) (a), (b) and (c) above.

1 Answer

5 votes

Final answer:

In programming, an overloaded method is one that has the same name but different signatures, consisting of either different parameter types or a varying number of parameters. The return type is not considered in method overloading.

Step-by-step explanation:

An overloaded method in programming refers to the creation of multiple methods in the same class that have the same name but different signatures. The signature of a method includes the number and types of its parameters, but not the return type. Therefore, overloading happens in the following scenarios:

  • The same method name with different types of parameters.
  • The same method name with a different number of parameters.

Given these points, the correct answer to the question is (d) Both (a) and (b) above - meaning that an overloaded method consists of the same method name with either different types of parameters or a different number of parameters.

User Papar
by
7.6k points