import java.io.*;
import java.util.Date;
import java.awt.Font;
/**
* @author Administrator
*
*/
public class list {
/**
* @param args
*/
static Date time=new Date();
public static void readFileByLines(String fileName)
{
File file =new File(fileName);
BufferedReader reader=null;
try {
System.out.println(
(time.getYear()+1900)+"年"+(time.getMonth()+1)+"月"+time.getDate()+"日"
+time.getHours()+"时"+time.getMinutes()+"分"
);
reader=new BufferedReader(new FileReader(file));
String tempString =null;
int line=1;
//
while ((tempString=reader.readLine())!=null)
{
System.out.println("显示行号"+line+tempString);
line++;
}
reader.close();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
finally {
if(reader!=null)
{
try {
reader.close();
} catch (Exception e) {
}
}
}
}
public static void main(String[] args) {
list show=new list();
show.readFileByLines("example.txt");
}
}