+ 1
whether the nested interface has 3 types:interface within a interface, interface within a class,interface within a abstract cls
And, if yes.. please suggest some examples to differentiate them..
6 RĂ©ponses
+ 1
You are implementing an interface so you must write 'implements A.It1'. If you have an abstract method inside a class than your class must also be abstract.
public class Test implements A.It1
{
public void m1()
{System.out.println("m1");
}
public void m2()
{System.out.println("m2");
}
public static void main(String args[])
{
Test t= new Test();
t.m1();
t.m2();
}
}
abstract class A
{ abstract void m1();
interface It1
{
void m2();
}
}
+ 2
I have covered all 3 in this small example and hope you differentiate all of them.
https://code.sololearn.com/cQuGt7nm22GQ/?ref=app
+ 1
Avinesh -- tqq for ur reply .. it's easy to understand (differentiate) ...In case if the interface A ,classC, abstract class E have their own methods how to implement them whether to use the keyword -> (implement or extend)
+ 1
Avinesh -https://code.sololearn.com/ch4UWD7EIeo8/?ref=app
What's the error over here ...could u please answer this question too..
+ 1
Avinesh tqq
0
PĂ vĂ(â âżă»)ââ you're welcome.