- ArrayList<ArrayList<Student>> list = new ArrayList<>();
- ArrayList<Student> first = new ArrayList<>();
- first.add(new Student("张三",23));
- first.add(new Student("里三",77));
- first.add(new Student("特有",34));
- first.add(new Student("低非",25));
-
- ArrayList<Student> second = new ArrayList<>();
- second.add(new Student("发个",53));
- second.add(new Student("发个",53));
- second.add(new Student("发个",53));
- second.add(new Student("发个",53));
-
- list.add(first);
- list.add(second);
-
- for(ArrayList<Student> a : list){
- for(Person p : a){
- System.out.println(p);
- }
- }
复制代码 |
|