I/O文件读取
/** author:xiaowang* date:2023/12/6* demand:读取java1班的数据* * */
package homework;import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;public class FileReadTest {public static void main(String[] args) {try {FileReader fi = new FileReader("E:\\workspace\\java软件1班.txt");int i = 0;while((i=fi.read())!=-1) {System.out.println((char)i+" ");}}catch (FileNotFoundException e) {System.out.println("文件不存在!");}catch (IOException e) {System.out.println("IO异常");}}}