import java.util.*;
class Student{
	String userName;
	String userSex;
	int    age;
	String  userClass;
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserSex() {
		return userSex;
	}
	public void setUserSex(String userSex) {
		this.userSex = userSex;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getUserClass() {
		return userClass;
	}
	public void setUserClass(String userClass) {
		this.userClass = userClass;
	}
}
public class Test2 {
	public static void main(String[] args) {
		List<Student> lsstu=new ArrayList<Student>();
		  Student  stu1=new Student();
		          stu1.setUserName("张三");
		          stu1.setUserSex("男");
		          stu1.setAge(23);
		          stu1.setUserClass("二班");
		  Student  stu2=new Student();
		          stu2.setUserName("李四");
		          stu2.setUserSex("男");
		          stu2.setAge(21);
		          stu2.setUserClass("三班");
		  lsstu.add(stu1); //把对象加入list中
		  lsstu.add(stu2);
		  for(int i=0;i<lsstu.size();i++){
		  	  Student stu=lsstu.get(i);
			  System.out.println("姓名--"+stu.getUserName());
			  System.out.println("性别--"+stu.getUserSex());
			  System.out.println("年龄--"+stu.getAge());
			  System.out.println("班级--"+stu.getUserClass());
		  }
	   }
   } 
