| 本帖最后由 林国锋 于 2011-10-6 19:07 编辑 
 this是当前类的引用吧
 super是指调用父类的构造函数
 如:
 public class Student extends SuperStudent{
 private int id;
 private String name;
 //省略setget方法
 public Student(int id){
 this.id = id;
 }
 public Sthdent(int id,String name){
 this(1);// 此处调用的是当前的相对应的构架函数
 this.name = name;
 super(id,name,"男");// 此处就是调用父类SuperStudent中的构造函数
 }
 }
 
 SuperStudent类
 public class SuperStudent{
 private int id;
 private String name;
 private String sex;
 
 // 省略 set get
 
 public SuperStudent(int id,String name,String sex){
 this.id = id;
 this.name = name;
 this.sex = sex;
 }
 }
 |