简单小程序错哪了

package collect;


import java.awt.List;

import java.util.ArrayList;

import java.util.Collections;

import java.util.Random;


public class CollectionsTest {


public void testSort1() {

List<Integer> integerList=new ArrayList<Integer>();

//好像错在上面The type List is not generic; it cannot be parameterized with arguments <Integer>

Random random=new Random();

Integer k;

for(int i=0;i<10;i++) {

k=random.nextInt(100);

}while(integerList.contains(k));

integerList.add(k);

System.out.println("成功添加整数:"+k);

System.out.println("---------排序前-------------");

for(Integer integer:integerList) {

System.out.println("元素:"+integer);

}

Collections.sort(integerList);

System.out.println("------------排序后------------");

for(Integer integer:integerList) {

System.out.println("元素:"+integer);

}

}


public static void main(String[] args) {

// TODO Auto-generated method stub

CollectionsTest ct=new CollectionsTest();

ct.testSort1();


}


}

http://img4.mukewang.com/59fd1d030001a3ca13660768.jpg

溯源1
浏览 1083回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java