I'm using the code below to compare two file input streams and compare them:
java.util.Scanner scInput1 = new java.util.Scanner(InputStream1);
java.util.Scanner scInput2 = new java.util.Scanner(InputStream2);
while (scInput1 .hasNext() && scInput2.hasNext())
{
// do some stuff
// output line number of InputStream1
}
scInput1.close();
scInput2.close();
How can I output the line number inside the while loop?