java接口(求大大们指导)

img

public class Test2 {
    
    public interface A{
        default void foo() {
            System.out.println("Calling A.foo()");
        }
    }
public static void main(String[] args) {
    Clazz clazz = null;
    clazz = new Clazz();
    clazz.foo();
}
}

class Clazz implements Test2.A {
    
    public Clazz() {
    }
}

主类名需和文件名字一致

第二行的 public 去掉