大家帮我看看为什么我会报错
package com.imooc.collection; import java.util.ArrayList; import java.util.List; import java.util.Random; public class Collections { public void testSort1(){ List<Integer>integerList=new ArrayList<Integer>(); Random random=new Random(); Integer k; for(int i=0;i<10;i++){ do{k=random.nextInt(100);}while(integerList.contains(k)); integerList.add(k); } System.out.println("------------排序前-------------"); for (Integer integer : integerList) { System.out.println("元素:"+integer); } Collections.sort(integerList); } public static void main(String[] args) { // TODO Auto-generated method stub } }
详细的是 The method sort(list<Integer>)is undefined for the type Collections