- 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("請輸入一個正整數");
- }
- }
- }
複製代碼 錯誤訊息為:4 g- t7 ]/ s: p' ^! r) A- k7 t' {
, q/ t6 X" x7 N9 k6 x! p h) M
Syntax error on token "int", delete this token# `+ z' M& l, V1 r3 C! Y3 n+ K4 Z
t cannot be resolved to a variable
6 K% A% ~8 g( [ h4 P- r1 V t cannot be resolved to a variable O% @$ v3 d$ |4 ]$ h* ?
1 I% V* }* u. _1 F D3 Q2 ~ at TQC103.main(TQC103.java:16) |