package Run; class Main{ private String name; private int age; public static void main(String[] args) { Main m = new Main("afds",2); } public Main(String name) { System.out.println("通过this调用的构造函数"); this.name = name; //第一种用法 } public Main(String name,int age) { this(name); //第二种用法 this.age = age; } }