public static void main(String[] args) {
try {
BufferedReader reader = new BufferedReader(new FileReader("file1.txt"));
String line1;
int lineNum = 1;
while ((line1 = reader1.readLine()) != null) {
System.out.println("第"+lineNum+"行内容:"+line1 );
lineNum++;
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}