Which of the following would successfully overload the method void calculate(int a, double b) ?
Tripura Public Service Commission - 2026,
Answer: B
The successful overload is void calculate(double b, int a).
An overloaded method must differ in its parameter list: the number, the types, or the order of the types. calculate(double, int) has the parameter types in a different order from calculate(int, double), so it is a distinct signature and a valid overload.
Changing only the return type (int calculate(int x, double y)) is not enough, nor is renaming the parameters (calculate(int b, doubie a), where 'doubie' is evidently a misprint for double, has the same types), nor is adding static, since modifiers are not part of the signature. All three would clash with the original method.
Please log in or register to report this question.