abstract class in java-运行 time polymorphism-superclass 参考

abstract class in java-run time polymorphism-superclass reference

我在 运行 下面的代码

中遇到错误
abstract class A {
    abstract void callMe();

    void callMeToo() {
        System.out.println("this is concrete method");
    }

}

class B extends A {
    void callMe() {
        System.out.println("B's implementation of callme");
    }
}

class AbstractDemo {
    public static void main(String args[]) {

        B b = new B();
        b.callMe();
        b.callMeToo();

    }
}

我收到如下错误消息:

run: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: B at abstractdemo.main(abstractdemo.java:28) C:\Users\JARVIS\AppData\Local\NetBeans\Cache.0\executor-snippets\run.xml:111: The following error occurred while executing this line: C:\Users\JARVIS\AppData\Local\NetBeans\Cache.0\executor-snippets\run.xml:68: Java returned: 1 BUILD FAILED (total time: 0 seconds)

public class AbstractDemo {
        abstract static class A { 
        public abstract void callMe(); 
        public void callMeToo() { }
      } 
      public static class B extends A { 
          public void callMe() { } 
      }
      public static void main(String args[]) {

        B b = new B();
        b.callMe();
        b.callMeToo();

     }
}