I am trying to get a line number when a term is searched line by line from a text file, when found I am trying to have it search a second file by that line number and save its contents as a string to be able to access the information later, tried to google it and read my java for dummies but Im either not wording it correctly or misunderstanding the concept
what would I use to save a line number located by a line by line readfile to get that same line from a second file and save both for use in the console while user is logged in?
Files are not inherently line oriented, they are simply long streams of bytes that get interpreted as characters (using some character encoding). The readline()/println() methods are simply conveniences that use the default line terminator to read (or write) the next line.
If you are trying to seek a certain line in a file, you’d have to read lines from the file, keep track of the line count yourself, and stop at the number you are seeking.
This will be very slow for large files. A faster way would be to use a byte position in the file, but this may or may not work for you.
If a byte position would work, you could use a FileChannel: http://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html