+ 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..

13th Sep 2020, 5:27 PM
Pàví(◠‿・)—☆
6 Respuestas
+ 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(); } }
14th Sep 2020, 3:39 AM
Avinesh
Avinesh - avatar
+ 2
I have covered all 3 in this small example and hope you differentiate all of them. https://code.sololearn.com/cQuGt7nm22GQ/?ref=app
13th Sep 2020, 5:42 PM
Avinesh
Avinesh - avatar
+ 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)
14th Sep 2020, 1:27 AM
Pàví(◠‿・)—☆
+ 1
Avinesh -https://code.sololearn.com/ch4UWD7EIeo8/?ref=app What's the error over here ...could u please answer this question too..
14th Sep 2020, 1:45 AM
Pàví(◠‿・)—☆
+ 1
14th Sep 2020, 3:42 AM
Pàví(◠‿・)—☆
0
Pàví(◠‿・)—☆ you're welcome.
14th Sep 2020, 3:43 AM
Avinesh
Avinesh - avatar