+ 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 Respostas
+ 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Ă­(â— â€żăƒ»)—☆
14th Sep 2020, 3:43 AM
Avinesh
Avinesh - avatar