of course not.
应该是,
iBuf = parseInt(system.in.read());

解决方案 »

  1.   

    Sorry, 少写一点东西。
    应该是,
    iBuf = Integer.parseInt(system.in.read());
      

  2.   

    我改了之后:
    ---------------- JDK Debug Build ------------------
    Compiling D:\JavaPro\t3_10.java
    Command line: "D:\j2sdk1.4.0\bin\javac.exe" -deprecation -g -classpath D:\JavaPro  "D:\JavaPro\t3_10.java"
    The current directory is: D:\JavaPro
    D:\JavaPro\t3_10.java:21: cannot resolve symbol
    symbol  : method parseInt  (int)
    location: class java.lang.Integer
    iBuf = Integer.parseInt(System.in.read());
                                          ^
    D:\JavaPro\t3_10.java:27: cannot resolve symbol
    symbol  : method parseInt  (int)
    location: class java.lang.Integer
    iBuf = Integer.parseInt(System.in.read()); 
                                                  ^
    2 errors
    Finished为什么?
    我在写程序的时候,用的是微软拼音,是不是不能用?只能在纯英文下?
      

  3.   

    sorry,是我的疏忽。
    用你的程序调试了一下,发现,
    你原先的程序错误在于,iBuf读进来的是一个char,把他转换成int以后,他就会变成这个char的ASCII数字,例如,输入一个3,iBuf就会是51,所以才会出现你上面所说的最大值是53的情况,因为你输入的最大值是5。
    为什么会输入5个数字就出来结果了呢?因为再你输入第一个数字以后,你按了一下回车,System.in.read()会把这个也当作字符接受进来,回车就是两个字符,是ASCII码中的13和10。
    所以建议你不要用这种输入方法,容易出错。
    该怎么写让我在调试一下,等一会儿告诉你。
      

  4.   

    以下程序调试通过。import java.io.*;public class t3_10
    {
    public static void main(String args[])
    {
    int iMax = 0;
    int iMin = 0;
    int iBuf = 0;
    int iCount = 20;

    try
    {
    System.out.println("请输入10个整数:");
                StringBuffer b = new StringBuffer();
    iBuf = System.in.read();
    while (iBuf != -1 && iBuf != '\n' && iBuf != '\r')
    {
                    b.append((char)iBuf);
                    iBuf = System.in.read();
                }
                iBuf = Integer.parseInt(b.toString());
                b = new StringBuffer();
    iMax = iBuf;
    iMin = iBuf;
    for(int iC = 1; iC < iCount; iC++)
    {
    iBuf = System.in.read();
         while (iBuf != -1 && iBuf != 10 && iBuf != 13)
         {
                        b.append((char)iBuf);
                        iBuf = System.in.read();
                    }
                    if (b.length()!=0)
                    {
                        iBuf = Integer.parseInt(b.toString());
                        if(iBuf > iMax)
        iMax = iBuf;
        if(iBuf < iMin)
        iMin = iBuf;
                    }
                    
                    b = new StringBuffer(); }
    }catch(IOException e) {}

    System.out.println("最小值:" + iMin);
    System.out.println("最大值:" + iMax);

    }
    }
      

  5.   

    我试了你上面的程序,但是还是有问题,
    Starting application D:\JavaPro\t3_10.class
    Command line: "D:\j2sdk1.4.0\bin\java.exe" -classpath D:\JavaPro t3_10
    The current directory is: D:\JavaPro
    请输入10个整数:
    12
    23
    34
    45
    56
    67
    7
    889
    90
    12
    23
    34
    45
    56
    67
    78
    89
    90
    12
    23
    最小值:7
    最大值:889
    Interactive Session Ended
    你是不是设了要输入20个数?
    我有些了一段代码:
    import java.io.*;
    public class t310
    {
    public static void main(String args[])
    {
    int iMax = 0;
    int iMin = 0;
    int iBuf = 0;

    try
    {
    System.out.println("Please input 10 integers:");

    BufferedReader br = 
    new BufferedReader(new InputStreamReader(System.in));
    iBuf = Integer.parseInt(br.readLine());
    iMax = iBuf;
    iMin = iBuf;
    for(int i = 1; i < 10; i++)
    {
    iBuf = Integer.parseInt(br.readLine());
    iMax = (int)Math.max(iBuf, iMax);
    iMin = (int)Math.min(iBuf, iMin);
    }
    }catch(IOException e) {}

    System.out.println("The max number you input is: " + iMax);
    System.out.println("The min number you input is: " + iMin);
    }
    }
    在我机子上通过了
      

  6.   

    呵呵,我的疏忽。
    我设了iCount=20了(见我的程序)。
    抱歉。
    改成10就对了。