首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

没实现抽象方法的具体类居然编译通过了

2012-12-19 
没有实现抽象方法的具体类居然编译通过了来自csdn:http://topic.csdn.net/u/20110131/09/7099a295-3877-4b

没有实现抽象方法的具体类居然编译通过了

来自csdn:

http://topic.csdn.net/u/20110131/09/7099a295-3877-4b2d-81bd-46137e5530c9.html

?

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 AbstractMethodError
extends 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.

热点排行