Hi, im fairly new to Java, learning as I go on. I have gotten to the stage that I need to read specific lines from a text file that has already been created.
Lets say my text document has 30 lines, and I only want to read what is in the 5th line without needing to read any other line. How would I go about doing this. I have looked on the forums and there is a lot of code but i dont understand most of it and dont know which is the better solution for me.
What I want to do is, open the file, read the 5th line as a string which i will later on use to compare with other strings to run different methods.
Also, how would i go about reading the last 5 lines of that text file but I do not know the number of lines that text file will have since in my code that will be created will be writing more lines into the text file, so i need the code to find the 5th to last line and read from there the contents which will later be printed out in a textbox.
Thanks to anyone that can help me out or point me in the right direction.