📜  获取文件中的行数java代码示例

📅  最后修改于: 2022-03-11 14:52:41.865000             🧑  作者: Mango

代码示例1
BufferedReader reader = new BufferedReader(new FileReader("file.txt"));
int lines = 0;
while (reader.readLine() != null) lines++;
reader.close();