System.in.read()返回的并不是你输入的数据!
看API文档。

解决方案 »

  1.   

    System.in.read 读取的是单个字符,返回的就是一个 int 型,不需要做转换,这个 int 值就是它读的那个字符的 ASCII 码。关于读取的问题,这里有一个小小的示例,看看吧/**
    * @(#) Test.java
    * @author fancy
    */import java.io.*;public class Test {    public static void main(String[] args) throws Exception {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            int a = Integer.parseInt(reader.readLine());
            int b = Integer.parseInt(reader.readLine());
            System.out.println("a = " + a + ", b = " + b);
        }}
      

  2.   

    System.in.read()返回的是对应的字符的ASCII码的int值,比如输入1得到的是'1'的
    ASCII值
      

  3.   

    system.in.read()相当于inputstream();返回的是INT,而不是你所要输入的STRING
      

  4.   

    那想要得到输入的STRING 怎么做啊 用char转换????
      

  5.   

    public static void read(){
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    String str="";
    String string[] = new String[100];
    int i = 0;
    try{

    while((str = br.readLine()).equals("q") != true){
    System.out.println("\t" + str);
    string[i] = str;
    i = i + 1;
    }
    }catch(Exception e){
    System.out.println(e.toString());
    }
    for(int j=0;j<i;j++)System.out.println(string[j]);
    }