需求:往一个学生类中插入多条包含姓名、年龄和性别的学生信息;然后循环取出集合中的学生数据信息
(1)首先一个学生类的代码如下:
package com.study.day8homework;
import org.seleniumhq.jetty9.http.DateGenerator;
/**
* @program: test
* @author: zhaona
* @create: 2020-10-13 09:51
**/
public class StudentHomework {
public String name;
public String age;
public String gender;
//alt+insert(自动生成代码) 自动生成属性的set、get方法
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
//带参构造函数
public StudentHomework(String name,String age,String gender) {
this.name=nam