来自csdn:
http://topic.csdn.net/u/20110131/09/7099a295-3877-4b2d-81bd-46137e5530c9.html
package pack1;
public abstract class A {
abstract void set();
}
package pack2;
import pack1.A;
public abstract class B extends A {
protected void set() {
}
}
package pack1;
import pack2.B;
public class C extends B {
public static void main(String[] args) {
A the = new C();
the.set();
}
}
let's have a try, if you compile it, you'll find no error occurs at compile time, why? as B does not override A, but the compilation passed, according to the java doc:
public class AbstractMethodErrorextends IncompatibleClassChangeError
Thrown when an application tries to call an abstract method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled.
no changes have been made, it still passes, is it the bug of the javac? let's check it out.