Ask Question

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

+4
Answers (1)
  1. 7 January, 05:52
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers