The default method is Java. Multiple inheritance super keyword confuses

public interface A{ default void decorateWithPaints(){ System.out.println("Decorate in A using paints"); } } public interface B{ default void decorateWithPaints(){ System.out.println("Decorate in B using paints"); } } public class C implements A,B{ @Override public void decorateWithPaints() { A.super.decorateWithPaints(); } } 

A.super.decorateWithPaints() what does this actually mean ??? We know that we can access the superclass method with the super keyword. But in this case, we must give the interface name to access the default interface method. It really bothers me.

0
source share

Source: https://habr.com/ru/post/1275678/


All Articles