这样就可以了
try{
    char a = (char) System.in.read();
}catch(IOException e){
    e.printStackTrace();
}

解决方案 »

  1.   

    没问题的,可能是你其他地方有错误:
    下面的例子就没问题!!
    import java.io.*;
    class BRRead {
    public static void main(String args[])
    throws IOException
    {
    char c;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter characters, 'q' to quit.");
    do {
    c = (char)br.read();
    System.out.println(c);
    } while(c != 'q');
    }
    }
      

  2.   

    right!print the error stack trace!Then you can locate the error reason!
      

  3.   

    try {
    char a = (char)System.in.read(); 
    } catch (IOException e) {
    System.out.println(e);
    }
    就不会错了
      

  4.   

    当然,除了RuntimeException外,所有的异常都不能忽略,要么就地处理,要么从函数利throw出去,那样的化,函数要加throws声明。