day07-常用类-ArrayList-使用步骤
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user