BufferedReader类的readLine方法和close方法会抛出IOException,如果main方法不声明抛出IOException或在main方法中捕获IOException的话,就会有编译错误.

解决方案 »

  1.   

    public static void main(String[] args) 
    throws java.io.IOException
    {}
    就ok了
      

  2.   

    import java.io.*;
    public class IOStreamDemo{
    public static void main(String[] args) throws IOException  
    {
    BufferedReader in = new BufferedReader(new FileReader("ss.txt"));
    String s;
    while((s=in.readLine())!=null)
    System.out.println(s);
    in.close();
     }
    }
    我还试了这样:public static void main(String[] args) 
    throws java.io.IOException
    {}
    还是不行,我怀疑是不是系统有问题,能解决的再帮帮忙!!
    总是在java.nio中找,没有在java.io中.
      

  3.   

    不好意思,我把jdk中的scr.zip解压出来后就不行,重新将那些文件删了可以了.感谢各位帮忙.