Lets say I have a text file called: data.txt (contains 2000 lines)
How do I read given specific line from: 500-1500 and then 1500-2000 and display the output of spec
The better way is to use BufferedReader. If you want to read line 32 for example:
for(int x = 0; x < 32; x++){ buf.readLine(); } lineThreeTwo = buf.readLine();
Now in String lineThreeTwo you have stored line 32.