老兄,你这那是有一个错误:
1. public FileIODemo构造函数少括号。
2. int data;没有被定义;
3. fin和fout被重复定义;
4. System.in和System.out用法不对。

解决方案 »

  1.   

    还有一个:
    FileOutStream->
    FileOutputStream。
      

  2.   

    你好 handongchen  :
        你的FileInputStream的参数不能是System.in;因为System.in是一个InputStream的实例,而FileInputStream的构造方法的参数没有InputStream。这个你可以查阅Sun的JDK文档,获得具体信息。
      

  3.   

    谢谢上面的老兄,我该了一部分,还有一个错误!请继续指教!import java.io.*;
    class FileIODemo
    {
      public static void main(String args[])
      {
        FileIODemo aFileIODemo=new FileIODemo();
       };
       
      public FileIODemo()
      {
        try 
        {
          FileInputStream fin=new FileInputStream(System.in);
          FileOutputStream fout=new FileOutputStream(new File("input.txt"));
          int nKeyIn;
          for(int n=0;n<10;n++)
          {
             nKeyIn=fin.read();
             fout.write(nKeyIn);
           }
          fout.close();
          
         // FileInputStream fin=new FileInputStream(new File("input.txt"));
          //FileOutputStream fout=new FileOutputStream(System.out);
          while(fin.available()>0)
          {
            nKeyIn=fin.read();
            fout.write(nKeyIn);
          }
          fin.close();
          fout.close();
        }
       catch(FileNotFoundException e)
       {
          e.printStackTrace();
       }
      catch(IOException exp)
      {
       exp.printStackTrace();
       }
      };
    }