1. package test;
    2. public class InterfaceExercise01 {
    3. public static void main(String[] args) {
    4. B b = new B();//ok
    5. System.out.println(b.a); //23
    6. System.out.println(A.a); //23
    7. System.out.println(B.a); //23
    8. }
    9. }
    10. interface A {
    11. int a = 23; //等价 public static final int a = 23;
    12. }
    13. class B implements A {//正确
    14. }

    image.png