Implicit super constructor Super() is undefined. Must explicitly invoke another constructor
不明确的超类构造函数Super()没有被定义。必须明确的调用其他构造函数。
你在Super中加入一个空的构造函数就可以了!
- public class Test {
- public static void main(String[] args)
- {
- Demo d = new Demo("yes");
- System.out.println(d.i);
- }
- }
- class Demo extends Super
- {
- public Demo(String s)
- {
- i= 2;
- }
- }
- class Super
- {
- int i= 0;
- public Super(){}
- public Super(String s)
- {
- i= 1;
- }
- }
复制代码
|