字符的读取和读出
package IO流.demo1;
import java.io.FileReader;
import java.io.FileWriter;
public class Demo4 {
public static void main(String[] args) {
FileReader fr = null;
FileWriter fw = null;
try {
fr = new FileReader(“C:\Users\hyn\Desktop\ff.txt”);//要读取的文件
fw = new FileWriter(“D:\tt.txt”);//读出到位置
int i = 0;
while ((i = fr.read()) != -1) {
fw.write(i);
System.out.println((char) i);//转换成字符型
}
fr.close();
fw.close();
} catch (Exception e) {
}
}
}