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 static import in java?
Is java same as core java?
What are basic keywords?
What is try-with-resources in java?
What is array initialization in java?
What is variable explain with example?
What is tree node in java?
What is a flag variable?
What is java util?
Variables used in a switch statement can be used with which datatypes?
Explain about abstract classes in java?
What is lastindexof in java?
What is jvm? How its run?
How does queue work in java?
Can you instantiate the math class?