What happen is that your for
loop will never end, since you don't put a termination condition, nor you "break" it inside the body of the for
. Try this and you will see:
for (int i = 0;; i++)
System.out.println("here");
System.out.println("\nReversed order of lines is as follows..\n");
You will get the same "unrecheable code".
Edit:
Try this:
boolean flag = false;
for (int i = 0;; i++) {
thisblock: {
inputs[i] = B.readLine();
if (inputs[i].charAt(0) == '0') {
flag = true;
break thisblock;
}
count++;
}
if (flag)
break;
}
Output:
Reversed order of lines is as follows..
0
3
2
1