k woww wrote:Why, if i uncomment reader.readLine will it still return the index of <PRE>? It confuses me because if I uncomment next = reader.readLine() and print out next, the reader.readLine() will advance to the next line, but apparently doesnt when using indexOf.
Calling "reader.readLine()" by itself advances to the next line and throws that line away. It doesn't change the value of the "line" variable, which therefore still contains <PRE>. Calling "next = reader.readLine()" advances to the next line and assigns that line to the "next" variable.