This is my code i have a doubt

class ab implements a,b
{

public void add()
{
System.out.println("Hi")
}
}

interface a
{
public void add();
}

interface b
{
public void add();
}

in this code i have two interface implemented in the class
has same method.just i want to know which method of
interface implemented in the class. interface a or interface
b? confused me .

Answer Posted / narayana

There should be no confusion. Since both the interfaces are
been implemented and both have the same method signature and
return type, it will
work fine and will take any of the method.
Since there is no implementation in Interfaces it is
difficult to know which interface the method is read.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are abstract functions?

577


what is the difference between thread and runnable types? : Java thread

554


Differentiate storage classes on the basis of their scope?

685


What is independent and dependent variables in research?

476


What is a java lambda expression?

571






What is the best definition for data?

537


Can we have multiple classes in single file ?

622


Does java isempty check for null?

586


Can there be an abstract method without an abstract class?

547


what is thread? : Java thread

567


What are loops in java?

561


Explain the private field modifier?

623


What are sets in java?

521


How does system arraycopy work in java?

597


Where local and global variables are stored?

559