Multiple choice

If there are two interfaces having the same method with different return types in a java code and if a class is going to implement the both interfaces, then what will be the output of the code?

  1. It will give compile time error.

  2. Code will compile.

  3. The method in the first interface will be executed.

  4. The method in the second interface will be executed.

  5. None of the above

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

Yes, the code will give compile time error as the compiler would not identify that which method to execute as they have conflicting return type.