Interface Implicitly inherit the Object class. Because interface SubInterface
default
Method call the Object
class hashCode
Method. It's possible then How & Why..?
package com.oca.test.exam;
interface SuperInterface {
default void printStuff() { System.out.println("Default Method"); }
}
interface SubInterface extends SuperInterface {
default void doStuff() {
this.printStuff();
System.out.println(this.hashCode());
}
}
public class InterfaceAbstractCombination implements SubInterface{
public static void main(String[] args) {
SubInterface sub = new InterfaceAbstractCombination();
sub.doStuff();
}
}