返回
软件
分类

FileReader/FileWriter的实例

日期: 2020-03-23 13:46 浏览次数 : 77

必赢备用网址 ,import java.io.*;
public class Test {
    public static void main(String[] args) {
        try {
            FileReader input = new FileReader("a.txt");
            FileWriter output = new FileWriter("temp.txt");
            int read = input.read();        
            while ( read != -1 ) {
                output.write(read);    
                read = input.read();
            }            
            input.close();
            output.close();
        } catch (IOException e) {
            System.out.println(e);
        }
    }
}