返回列表 發帖

?????

  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3. public class TQC103 {
  4.         public static void main(String[] args) {
  5.         BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
  6.         System.out.println("請輸入育產生之亂數:");
  7.         try{
  8.                 String ss = bf.readLine();
  9.                 int num = Integer.valueOf(ss);
  10.                 int[] rnd = new int[num];
  11.                 for(int i = 0; i < num; i++){
  12.                         rnd[i] = (int)(Math.random()*1000);
  13.                         for(int i1 = 1 ; i1 < num; i1++){
  14.                                 for(int j = 0; j < i; j++){
  15.                                         if(rnd[j] > rnd[i])
  16.                                         int t  = rnd[j];
  17.                                         rnd[j] = rnd[i];
  18.                                         rnd[i] = t;
  19.                                 }for(int i2 = 0; i2 < num; i2++)
  20.                                 System.out.printf("%3d\t" + rnd[i]);
  21.                         }
  22.                 }
  23.         }catch(Exception e)
  24.         {
  25.                 System.out.println("請輸入一個正整數");
  26.         }

  27.         }
  28. }
複製代碼
錯誤訊息為:& T4 [# u3 C- @2 N8 h: ]

) N9 P+ d' T7 Q# F4 gSyntax error on token "int", delete this token! T/ B3 G+ r& j7 q) F
        t cannot be resolved to a variable
, V5 [8 d2 _7 q5 |' p        t cannot be resolved to a variable: C. W/ F& p/ L+ z

9 }' ?/ }6 e; d1 l, w' G5 h        at TQC103.main(TQC103.java:16)

返回列表