Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface A{
- default public void method1(){
- System.out.println("method1 printing from interface A");
- }
- default public void method2(){
- method1(); // note that method1() is overriden in class C.
- // which one should be called? from A or C?
- }
- }
- interface B extends A{
- void methodWhichCallsMethodOnInterface();
- }
- class C implements B{
- @Override
- public void method1(){
- System.out.println("method1 printing from class C");
- }
- @Override
- public void methodWhichCallsMethodOnInterface(){
- method2();
- }
- }
- B b;
- b.methodWhichCallsMethodOnInterface();
Add Comment
Please, Sign In to add comment