随便找个文本文件试试下面代码,很简单
- package com.xiaozhi.test;
- import java.io.FileReader;
- import java.io.PrintStream;
- public class Test {
- public static void main(String[] args) throws Exception {
- FileReader fileReader=new FileReader("c:\\1.txt");
- while(true)
- {
- System.out.println(fileReader.read());
- }
- }
- }
复制代码 |