Student.java
public class Student {
String name;
int age;
String address;
boolean isMen;
Student(){
System.out.println("无参");
}
Student(String name){
this.name = name;
}
Student(int age,String name){
this.age = age;
this.name = name;
}
Student(String name,int age,String address,boolean isMen){
this.name = name;
this.age = age;
this.address = address;
this.isMen = isMen;
}
}
TestStudent.java
public class TestStudent {
public static void main(String[] args) {
Student zhangsan = new Student();
Student lisi =new Student(19,"lisi");
Student wangwu = new Student("wangwu",20,"huxian",true);
}
}