Java读取文件最后两行

File f=new File("C:\\123.txt");

BufferedReader br = new BufferedReader(new FileReader(f));

String line = br.readLine(), lastsecline= "", lastline = "";

while(line!= null){

lastsecline=lastline ;

lastline =line.trim();

line=br.readLine();

}

System.out.println("lastsecline= "+lastsecline);

System.out.println("lastline = "+lastline );

上一篇:简单的XML操作类


下一篇:SubmitText 中配置lua 运行环境