请好心人士帮忙看一下
- import java.io.*;
- class LineNumberReader
- {
- public static void main(String[] args)
- {
- FileReader fr=null;
- LineNumberReader lnr=null;
- try
- {
- fr=new FileReader("MyBufferedLineDemo.java");
- lnr=new LineNumberReader(fr);
- String s=null;
- while((s=lnr.readLine())!=null)
- {
- System.out.println(s);
- }
- }
- catch(IOException e)
- {
- System.out.println(e.toString());
- }
- finally
- {
- try
- {
- if(lnr!=null)
- lnr.close();
- }
- catch(IOException e)
- {
- System.out.println(e.toString());
- }
- }
- }
- }
复制代码
|