Interface A {
String test();
}
Interface B {
int test();
}
Create a class AB which must implements both A & B
interfaces.
Answer Posted / sumit
interface A {
String test();
}
interface B {
int test();
}
class AB implements A
{
public String test()
{ System.out.println("Test1 in AB");
return "a";
}
}
class Test
{
public static void main(String as[])
{
AB i = new AB();
B b = new B(){
public int test()
{
System.out.println("Test");
return 1;
}
};
i.test();
b.test();
}
}
Is This Answer Correct ? | 3 Yes | 5 No |
Post New Answer View All Answers
What is a blocking method in Java?
Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.
why doesn't java run on all platforms?
How do you declare a string variable?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
How do you escape json?
Can a set contain duplicates?
Can we nested try statements in java?
Why main() method is public, static and void in java ?
What is the differences between heap and stack memory in java? Explain
what is abstract class in Java?
What is the default size of arraylist in java?
When would you use a static class?
What is a stringbuffer?
What is visibility mode?