返回列表 發帖

??

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

  26.         }
  27. }
複製代碼

Exception in thread "main" java.lang.Error: Unresolved compilation problems: ; {1 L& Q' Z- a; z
        ImputStreamReader cannot be resolved to a type, s+ {8 V4 L( G+ Q/ @) _; n: O
        Syntax error on token "int", delete this token, Q6 ]1 m! {, P! P5 @# E& d9 u
        t cannot be resolved to a variable
% i: a7 _& Q3 J5 I" J  F        t cannot be resolved to a variable
6 Q6 q! P6 ?7 A  b2 p- H0 I5 `, v2 _4 `- k5 ]
        at TQC103.main(TQC103.java:4)

TOP

Unresolved compilation problems: $ {6 Z; m5 E% K: e5 B" E
ImputStreamReader cannot be resolved to a type
1 j6 l* k, {: M2 f+ o' l& d9 V正確的寫法如下:
9 m( F( F5 y3 W! p% ?; y- _4 e) JInputStreamReader !!

TOP

返回列表