180k views
4 votes
Which method is an example of overloading the method that follows?public int ParseNumber(String numberString){...}a.public int Parse(String numberString){...}b.public int ParseNumber(String num){...}c.public int ParseNumber(String numberString, String entry){...}

User Krystyne
by
5.0k points

1 Answer

5 votes

Answer:

Option c public int ParseNumber(String numberString, String entry){...}

Step-by-step explanation:

Method overloading is the way we can define different methods that share the same name but with different signatures. The method signatures can refer to the number of input parameters or the type of input parameters. For example, if given a method multiplication as below

public int multiplication(int a, int b){

....

}

We can overload the method above by having different signatures

//Overloaded method 1

public double multiplication(double a, double b){

.........

}

//Overloaded method 2

public int multiplication(int a, int b, int c ){

.........

}

There for the option c is an example of method overloading as it has the same method name with the original method but with different signature - one more string type parameter.

User Gogagubi
by
4.9k points