Java的Reader和Writer类 Li.043
FileReader 读取文件 import java.io.FileReader; import java.io.IOException; public class Demo1_FileReader { public static void main(String[] args) throws IOException { // Demo1(); FileReader fr = new FileReader("m.txt"); int b ; while ( (b = fr.read()) != -1){ System.out.println((char)b); } fr.close(); } private static void Demo1() throws IOException { FileReader fr = new FileReader("m.txt"); int x = fr.read(); System.out.println(x); System.out.println((char)x); } } FileWriter 字符写入文件 import java.io.FileWriter; import java.io.IOException; public class Demo2_FileWriter { public static void main(String[] args) throws IOException { FileWriter fw = new FileWriter("output....