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


Please Help Members By Posting Answers For Below Questions

Can we declare the static variables and methods in an abstract class?

554


What are design patterns and please explain?

576


What is return code?

564


How do you join strings in java?

532


How to Sort Strings which are given in List and display in ascending order without using java api.

3783






How do you sort arraylist in descending order?

583


What is a default constructor and also define copy contrucyor?

607


Which data type is class in java?

559


What causes memory leak in java?

484


Is java based on c?

543


What is java life cycle?

541


List some important features of java 10 release?

521


Write a program to print the pattern given below

503


How are variables stored?

533


Is set ordered in java?

576