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 are the Class Libraries ?
How does queue work in java?
How does singleton class work?
Is there any difference between synchronized methods and synchronized statements?
Why set do not allow duplicates in java?
What is a buffer in computer?
What is serialization in java?
What are sets in java?
How to compare two strings in java program?
Are the imports checked for validity at compile time? Will the code containing an import such as java.lang.abcd compile?
How many bytes is a unicode character?
What does split function do in java?
What is public static void main?
What is the independent variable in an experiment?
What is Java Package and which package is imported by default?