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 .
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
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 |
How can you read an integer value from the keyword when the application is runtime in java? example?
why we r not use pointers in corejava?
What is the use of bufferedreader?
What is size_t?
what are three ways in which a thread can enter the waiting state? : Java thread
Explain about the security aspect of java?
Explain about version control?
Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?
0 Answers Akamai Technologies,
Write a program to check for a prime number in java?
What are static blocks and static initalizers in java ?
What is the default value stored in Local Variables?
Is java jre still free?