Java: Calling a default interface method from implementing class

You use the syntax SomeInterface.super.method(). Here's an example:

interface SomeInterface {
    default void method() {
        System.out.println("Default implementation");

class SomeImplementation implements SomeInterface {

    public void method() {
        System.err.println("Overriding implementation");

    public static void main(String[] args) {
        new Scratch().method();

Note that super.method() does not work since that attempts to invoke method() from an extended class.


Be the first to comment!