本文共 412 字,大约阅读时间需要 1 分钟。
public class Test { public static void main(String[] args) { int number[] = new int[10]; while (true) { int num = (int) Math.random() * 10 + 1; for (int i = 0; i < number.length; i++) { if (number[i] == 0) { number[i] = num; break; } else { if (number[i] == num) break; } } if (number[9] != 0) { break; } } for (int j : number) { System.out.println(j + " "); } }}
转载地址:http://jlrqj.baihongyu.com/