集合框架练习1

Posted 苏轼的红烧肉

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了集合框架练习1相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章