I have this File :
Line1.
Line2.
Line3.
Line4.
I want to start reading from the second line (Line2
) till the end of the file. How can i do this in Java?
I have this File :
Line1.
Line2.
Line3.
Line4.
I want to start reading from the second line (Line2
) till the end of the file. How can i do this in Java?
If you want to read the file line by line, but skip the first line, I suggest you do
Files.lines(Paths.get("yourfile"))
.skip(1)
.forEach(...);
Note that this solution relies on an API that was added in Java 8 (released March last year), so if you haven't upgraded yet, you may want to do so.