44.1k views
1 vote
Consider the following code snippet: public class Employee { . . . public void setEmployeeDept(String deptNum) { . . . } } public class Programmer extends Employee { . . . public void setEmployeeDept(int deptNum) { . . . } } Which of the following statements is correct?

1 Answer

4 votes

Answer:

The programmer Class overload the 'setEmployeeDept()' function.

Step-by-step explanation:

Method overloading is the feature where two or more than two functions have same names but the different parameters.

For example:

int fun( ){ }

int fun(int a){ }

int fun(String a){ }

Here, all these methods are overloaded function because they have same names but different arguments.

User Andrew Myers
by
8.0k points