67 lines
1.2 KiB
Java
67 lines
1.2 KiB
Java
package com.inmind.arraylist03;
|
|
|
|
|
|
public class Student {
|
|
private String name;
|
|
private int age = 18;
|
|
private int id;
|
|
private String gender;
|
|
private double score;
|
|
|
|
|
|
public Student(){
|
|
//对所有的属性设置默认值
|
|
}
|
|
|
|
public Student(String name){
|
|
//针对指定的属性赋值,其他的属性默认
|
|
this.name = name;
|
|
}
|
|
|
|
public Student(String name, int age){
|
|
//针对指定的属性赋值,其他的属性默认
|
|
this.name = name;
|
|
this.age = age;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public int getAge() {
|
|
return age;
|
|
}
|
|
|
|
public void setAge(int age) {
|
|
this.age = age;
|
|
}
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(int id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getGender() {
|
|
return gender;
|
|
}
|
|
|
|
public void setGender(String gender) {
|
|
this.gender = gender;
|
|
}
|
|
|
|
public double getScore() {
|
|
return score;
|
|
}
|
|
|
|
public void setScore(double score) {
|
|
this.score = score;
|
|
}
|
|
}
|