I'm using a variable line
, which after the method turns into lineOld
. So for the first time running the method lineOld
is undefined.
So while compiling it gives me the error variable lineOld
might not have been initialized.
I've tried to give lineOld
a value just once (See first for
and while
), but no go.
Any help :) ?
String inputLine;
String lineOld;
String line = "";
int test = 0;
for (int i = 0; i == 0; i++) {
lineOld = "";
}
while (test == 0) {
lineOld = "";
test++;
}
while ((inputLine = in.readLine()) != null) {
line = line + inputLine;
}
System.out.println(line);
if (line == lineOld) {
System.out.println("No difference");
} else {
System.out.println("VERSCHIL");
}
lineOld = line;