Q.1
Solution for
the above:
public class HelloWorld {
public static void main(String[]args){
TestClass test=new TestClass();
test.diplay();
}
}
interface TestInterface{
void display();
}
interface|1 extends TestInterface{
@Override
void display();
}
interface|2 extends TestInterface{
}
class TestClass implements|1,|2{
@Override
pulic void display(){
sytem.out.printIn('Yes\");
}
}
so this is the code given according to the
problem.
-first interface i have overrriden the class but in
other i have not done.
-make sure that if an interface extends another
interface it is not required to override the
methods.
-the methods are overrriden in all the interface.
complier will not give error.
now, lets see the code for the
requirement:
public class HellowWorld{
public static void main(string[]args){
TestClass test=new TestClass();
test.display();
}
}
interface TestInterface{
void display();
}
interface|1extends TestInterface{
@overrride
void display();
}
interface|2 extends TestInterface{
@override
void display();
}
class TestClass implements |1,|2{
@overrride
public void display(){system.out.printIn(\"Yes\");
}
}