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 / gohil

You can dynamically implement any of the interface
Ex
a intAImpObj= new ab();
b intBImpObj= new ab();

In above case intAImpObj is the implementation of a
interface and intBImpObj is the implementation of b interface

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is string class considered immutable?

765


Why do we use bufferedreader?

704


What is the main function in java?

720


Which types of exceptions are caught at compile time?

735


What is difference between null and void?

698






What are the drawbacks of singleton class?

743


What is public static?

685


EDS (Electronic Data Systems India Pvt Ltd) at Chennai on 16-12-2006.

8851


how its run?

781


What is the difference between final, finally and finalize() in java?

727


What is the difference between ArrayList and Vector? which one is better in Java

789


How does multithreading take place on a computer with a single cpu?

735


What is string and its types?

813


Can list be null in java?

741


What is methods in java?

729