Multiple choice

When is it OK to have an overloaded method that has a different return type?

  1. Only when the parameter list is also different

  2. Never

  3. Always

  4. At compilation time

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Method overloading requires that the parameter list (number, type, or order of arguments) be different. Changing only the return type is not sufficient for overloading.