Multiple choice technology programming languages

A class can define two methods with the same name as long as the return types are different

  1. True

  2. False

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

In most statically-typed languages including Java, method overloading requires different parameter lists - return type alone is insufficient to distinguish methods. The compiler would be unable to determine which method to call when the return value is not used or assigned. Overloaded methods must have unique signatures based on parameter types and count.