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
Can we declare the static variables and methods in an abstract class?
What are design patterns and please explain?
What is return code?
How do you join strings in java?
How to Sort Strings which are given in List and display in ascending order without using java api.
How do you sort arraylist in descending order?
What is a default constructor and also define copy contrucyor?
Which data type is class in java?
What causes memory leak in java?
Is java based on c?
What is java life cycle?
List some important features of java 10 release?
Write a program to print the pattern given below
How are variables stored?
Is set ordered in java?