BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("請輸入育產生之亂數:");
try{
String ss = bf.readLine();
int num = Integer.valueOf(ss);
int[] rnd = new int[num];
for(int i = 0; i < num; i++){
rnd[i] = (int)(Math.random()*1000);
for(int i1 = 1 ; i1 < num; i1++){
for(int j = 0; j < i; j++){
if(rnd[j] > rnd[i])
int t = rnd[j];
rnd[j] = rnd[i];
rnd[i] = t;
}for(int i2 = 0; i2 < num; i2++)
System.out.printf("%3d\t" + rnd[i]);
}
}
}catch(Exception e)
{
System.out.println("請輸入一個正整數");
}
}
}
複製代碼
錯誤訊息為:. `+ `9 h u" R) H8 f/ \
6 p: M- \, t7 X- P4 n, f4 I! e& W1 bSyntax error on token "int", delete this token 1 K3 O* C7 F3 [# ^! O9 Z" e9 b t cannot be resolved to a variable$ Y* } K% Y! m
t cannot be resolved to a variable # I; S0 j0 r: w. W0 p, [0 e 1 p5 e/ j# s2 J& U6 ? at TQC103.main(TQC103.java:16)