【发布时间】:2012-07-25 19:08:29
【问题描述】:
所以我在一些我正在使用的代码中遇到了一些障碍。基本上我有以下三个代码:
抽象类:
public abstract class TestParent {
int size;
public TestParent(int i){
size = i;
}
}
儿童班:
public class TestChild extends TestParent{
public void mult(){
System.out.println(this.size * 5);
}
}
实施:
public class TestTest {
public static void main(String args[]) {
TestChild Test = new TestChild(2);
Test.mult();
}
}
【问题讨论】:
-
我错过了吗?我没有看到问题:)
-
@jeff 问题是:为什么不编译
-
当你的超类不使用默认的无参数构造函数时——实现者必须提供构造函数
标签: java constructor abstract