import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class RandomOut {
static Random r = new Random();
static List<Integer> randomList = new ArrayList<Integer>();
static int randomNumber = 0;
public static void main(String[] args) {
for(int i=0; i<20; i++) {
randomNumber = r.nextInt(90) + 10;
randomList.add(randomNumber);
}
Collections.sort(randomList);
int num = 0;
for(int i=0; i<randomList.size(); i++) {
num = randomList.get(i);
System.out.println(num);
}
}
}
温馨提示:内容为网友见解,仅供参考