In java8, we are using interface.super. Considering the below pointsThere are 2 interfaces but none of the interfaces inherit to another.There is implementation class which is inheriting both of those 2 interfaces.Each interface has a default method but the name is same for both of those methods.Now in this scenario, in the implementation class it is forcing me to override the default print() method. And in the body I need to use eitherInterface_one.super.print();orInterface_two.super.print();I am new to Java8, I would like to understand the strange behaviours of using the interface.super. Also the implementation of print() method forcing the statements Interface_one.super.print(); or Interface_two.super.print(); public interface Interface_one {    public void method1();    default void print(){        System.out.println(this is default print in first interface);    }}public interface Interface_two {public void method2();    default void print(){        System.out.println(this is default print in second interface);    }}public class ImplementedClass implements Interface_one, Interface_two{    @Override    public void method1() {        System.out.println(Implemented Method 1);    }    @Override    public void method2() {        print();        System.out.println(Implemented Method 2);    }    @Override    public void print() {        Interface_one.super.print();    }    public static void main(String[] args) {        new ImplementedClass().method2();    }}
usage of interface.super.print() in java8
java8
If you inherit from two interfaces A and B, then A.super.foo() calls the foo (default) method of the A interface.  When you implement two interfaces which each have default methods with the same name, it's ambiguous.  You need to resolve that ambiguity by explicitly stating which of the two default methods you'd like your implementation to use.  You do this by overriding the method in question and calling the parent interface's implementation directly.  You do this with the new syntax: ParentInterfaceName.super.methodName();