- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- public class TQC103 {
- public static void main(String[] args) {
- 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("請輸入一個正整數");
- }
- }
- }
複製代碼 錯誤訊息為:( C8 ^+ ]& [# A( [8 J8 O
# J/ h6 Z) I) h' ]; V0 XSyntax error on token "int", delete this token( u) G" t1 e3 J1 d7 i; `0 n# P
t cannot be resolved to a variable
4 n1 m) H5 z% D7 T* i t cannot be resolved to a variable
" n/ o3 M6 x0 o: t. H8 f9 }3 P: G. ]! G% Y% u6 m* H. I" p
at TQC103.main(TQC103.java:16) |