Ask Question
28 August, 07:40

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) { ... }

+5
Answers (1)
  1. 28 August, 10:37
    0
    Option c public int ParseNumber (String numberString, String entry) { ... }

    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.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which method is an example of overloading the method that follows? public int ParseNumber (String numberString) { ... }a. public int Parse ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers