import java.io.FileReader;
import java.io.IOException;
public class FileReaderDemo {
public static void main(String[] args)
{
FileReader fr=null;
try {
fr= new FileReader("c:\\test.txt");
int s=0;
while((s=fr.read())!=-1)
{
// s=fr.read();
System.out.println("ch=" + (char)s);
}
} catch (IOException e) {}
finally
{
try {
fr.close();
} catch (IOException e) {}
}
}
}
这样才可以,上面读取了,下面就不要读取了! |