1. 程式人生 > >集合框架練習1

集合框架練習1

oid () args ati test 練習 set 汪峰 []

package fanxing;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {
    List<Student>list=new ArrayList<Student>();
list.add(new Student("劉德華", 85));
list.add(new Student("張學友", 100));
list.add(new Student("劉傑", 65));
list.add(
new Student("汪峰", 57)); list.add(new Student("周迅", 76)); System.out.println(list.size()); list.remove(2); for(Student p:list){ System.out.println(p); } Student s=list.get(0); s.setScore(95); for(int i=0;i<list.size();i++){ if(list.get(i).getScore()<60){ System.out.println(list.get(i)); } } } }

集合框架練習1