List<Student> list = new ArrayList<>();
public void addStu(int stuNo,String name, String sex,int chinese,int match,int english){
Student s = new Student(stuNo,name,sex);
s.map.put("chinese",chinese);
s.map.put("match",match);
s.map.put("english",english);
list.add(s);
}
因为要将创建的对象放进List集合,不知道怎么快速在集合中取出对象
alibaba fastjson
Student student = JSONObject.parseObject(jsonStr , Student.class);// jsonStr 是String类型。
List<Student> studentList = JSONObject.parseArray(stuString, Student.class);
。。。。 List取你的对象是list[0] 把你存进的第一个对象全部取出来 然后你想取对象里的东西是list[0].chinese把键为chinese的值取出来
取出s嘛?
不是很懂要什么要的效果,对象的名字?