·this调用本类的构造函数 public class test { public static void main(String arg[]) { Student a = new Student(); Student b = new Student("1111 1111"); Student c = new Student("2222 2222" , "c"); } } class Student { private String ID; private String name; Student() { System.out.println("新建一个学生"); } Student(String ID) { this(); //this调用本类的构造函数,且必须放在构造函数的首行 this.ID = ID; System.out.println("为该学生分配学号"); } Student(String ID , String name) { this(); this.ID = ID; this.name = name; System.out.println("为该学生分配学号并且录入名字"); } }