Reading a specific line from a text file in Java

后端 未结 9 765
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 07:34

Is there any method to read a specific line from a text file ? In the API or Apache Commons. Something like :

String readLine(File file, int lineNumber)
         


        
9条回答
  •  囚心锁ツ
    2020-11-27 08:15

    According to this answer, Java 8 enables us to extract specific lines from a file. Examples are provided in that answer.

提交回复
热议问题