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 / kanu butani

There should be no confusion. Since both the interfaces are
been implemented and both have the same method, 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 ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are accessor methods in java?

561


What do you know about the garbage collector?

619


How do you start a thread?

558


How do you sort an array in java?

549


What is the purpose of the runtime class in java programming?

575






What are three types of loops in java?

593


What is the purpose of the system class in java?

562


What is a function easy definition?

535


What is variable and rules of variable?

522


Why array is used in java?

523


Is multiple inheritance supported by java?

514


How many types of java are there?

575


Where pragma is used?

604


What are the types of sockets in java?

549


Why stringbuilder is not thread safe?

550