摘要: 一.子类中如果需要调用父类中的构造函数,则需要使用super(),且必须在构造函数中的第一行public class Demo1 { public static void main(String[] args) { Sub sub=new Sub(); }}class Base { public Base() { System.out.println("Base"); }}class Sub extends Base { public Sub() { //调用父类的构造方法,必须为第一行 super(); ... 阅读全文
posted @ 2013-12-17 20:03 顺冉 阅读(459) 评论(0) 推荐(0) 编辑