day07-常用类-ArrayList-使用步骤

This commit is contained in:
xx
2026-01-19 16:16:51 +08:00
parent d0ef288686
commit 73c8bb8d32
2 changed files with 131 additions and 0 deletions
@@ -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;
}
}