1.

What would be the result if a class extends two interfaces and both have a method with same name and signature? Lets assume that the class is not implementing that method.(a) Runtime error(b) Compile time error(c) Code runs successfully(d) First called method is executed successfullyThis question was posed to me in an online interview.Question is taken from Inheritance in chapter Inheritance of Java

Answer»

The correct choice is (b) COMPILE TIME error

To explain I WOULD SAY: In case of such CONFLICT, compiler will not be able to link a method call due to ambiguity. It will throw compile time error.



Discussion

No Comment Found

Related InterviewSolutions