Given the class below,
which method signature could be successfully added to the class as an overloaded version of the m()
method?
public class Main { public Integer m(int sum) { return sum; } }
B.
Options A and D would not allow the class to compile because two methods in the class cannot have the same name and arguments, but a different return value.
Option C would allow the class to compile, but it is not a valid overloaded form of our m()
method since it uses a different method name.
Option B is a valid overloaded version of the m()
method, since the name is the same but the argument list differs.