KnowledgeBoat Logo
|

Computer Applications

What is the type of error, if any, when two methods have the same method signature?

  1. Runtime error
  2. Logical error
  3. Syntax error
  4. No error

User Defined Methods

39 Likes

Answer

Syntax error

Reason — If two methods in the same class have the same method signature (i.e., the same method name and the same parameters), the Java compiler will report a syntax error. This is because Java does not allow duplicate method signatures in the same class as it cannot differentiate which method to call.

Answered By

18 Likes


Related Questions