System.in.readline()
System.in.read()

解决方案 »

  1.   

    我用sdk
    请问那里有这种调用的文档下载??
      

  2.   

    http://java.sun.com/j2se/1.4.2/download.html#docs
      

  3.   

    package mytool;import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    import java.lang.NumberFormatException;public class StandardInputReader extends BufferedReader {    /**
         * Constructs a new input stream with the specified standard input stream
         */
        public StandardInputReader() {
            super(new InputStreamReader(System.in));
        }    /**
         * Read a boolean value from standard input stream.
         *
         * @return a boolean value.
         * @throws IOException
         */
        public boolean readBoolean() throws IOException {
            String strBoolean = super.readLine();        if (strBoolean.equalsIgnoreCase("true")) {
                return true;
            } else if (strBoolean.equalsIgnoreCase("false")) {
                return false;
            } else {
                throw new NumberFormatException("For input string: \""
                                                + strBoolean +"\"");
            }
        }    /**
         * Read a byte value from standard input stream.
         *
         * @return a byte value.
         * @throws IOException
         */
        public byte readByte() throws IOException {
            return Byte.parseByte(super.readLine());
        }    /**
         * Read a short value from standard input stream.
         *
         * @return a short value.
         * @throws IOException
         */
        public short readShort() throws IOException {
            return Short.parseShort(super.readLine());
        }    /**
         * Read a int value from standard input stream.
         *
         * @return a int value.
         * @throws IOException
         */
        public int readInt() throws IOException {
            return Integer.parseInt(super.readLine());
        }    /**
         * Read a long value from standard input stream.
         *
         * @return a long value.
         * @throws IOException
         */
        public long readLong() throws IOException {
            return Long.parseLong(super.readLine());
        }    /**
         * Read a float value from standard input stream.
         *
         * @return a float value.
         * @throws IOException
         */
        public float readFloat() throws IOException {
            return Float.parseFloat(super.readLine());
        }    /**
         * Read a double value from standard input stream.
         *
         * @return a double value.
         * @throws IOException
         */
        public double readDouble() throws IOException {
            return Double.parseDouble(super.readLine());
        }
    }
      

  4.   

    可以用java.io流java.read()
    也可以通过main的参数实现输入