初始化类的一个对象,该类提供接收几个类型的数据的构造函数,来初始化该对象的数据成员
class User{
private String name;
private Integer id;
private String sex;
User(){}
User(String name, Integer id, String sex){
this.name =name;
this.id = id;
this.sex = sex;
}
User(String name, Integer id){
this.name =name;
this.id = id;
}
User(String name, String sex){
this.name =name;
this.sex = sex;
}
User(Integer id, String sex){
this.id = id;
this.sex = sex;
}
User(String name){
this.name =name;
}
User(Integer id){
this.id = id;
}
}