java_io.FileReaderStream

来源:互联网 发布:js 数组排序函数 编辑:程序博客网 时间:2024/05/17 12:50
Java的IO操作有很多小细节的东西  希望你可以通过我的日志来巩固你的技术或是帮你复习你的知识package com.java_io.FileReaderStream;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.IOException;public class TestFileReader {public static void main(String[] args) {FileReader fr = null;int c = 0;try {fr = new FileReader("F:\\Java\\public\\文本\\java学习顺序.txt");while ((c = fr.read()) != -1) {System.out.print((char) c);}fr.close();} catch (FileNotFoundException e) {System.out.println("找不到指定文件");System.exit(-1);} catch (IOException e) {System.out.println("文件读取错误");System.exit(-1);}}}

0 0
原创粉丝点击