www.gusucode.com > 胡伏湘《Java程序设计实用教程》PPT+源码集源码程序 > 胡伏湘《Java程序设计实用教程》PPT+源码集/java程序设计/java程序设计/习题答案/009/temp.txt

    // Page 182
// ??????????
//3????д???򣬽??????ļ???Դ???븴?Ƶ??????ļ?????Ŀ¼?µ?"temp.txt"?ļ??С??Ĺ??ܡ?

import java.io.*;

public class XT009203  {
  public static void main(String args[])  {
    try  {
      FileInputStream fis = new FileInputStream("XT009203.java");
      FileOutputStream fos = new FileOutputStream("temp.txt");
      int read = fis.read();
      while ( read!=-1 ) {
        fos.write(read);
        read = fis.read();
      }
      fis.close();
      fos.close();
          
    }
    catch ( IOException e )  {
      System.out.println(e);
    }
  }
}