package io;
import java.io.FileReader;
import java.io.FileWriter;
public class FileRead {
public static void main(String[] args) {
try {
FileReader fr = new FileReader("F://eclipseWorkStation//temp//沙耶之歌.txt");
FileWriter fw = new FileWriter("F://eclipseWorkStation//temp//to//沙耶之歌.txt");
int a =-1;
while((a=fr.read())!=-1){
System.out.print((char)a);
fw.write(a);
}
fw.flush();
fw.close();
} catch (Exception e) {
// TODO: handle exception
}
}
}
flush()和close()不写的时候会造成文件没有写入的现象。