Originally posted by Pavan Chillara:
void X() {
final int n = 0; // Statement (1)
System.out.println("This is Example");
while (true) {
n = A(j); // Compilation Error --> Statement (2)
System.out.println("n " + n);
j++;
if (n == 25)
break;
}
}
}
At (1), you definitely assign "n" the value 0, which is a final variable. At (2), you are trying to re-assign a value to "n", a final variable, which already is
definitely assigned a value at (1). This is the error in your program; its not possible to change the value of 'n' once you have definitely assigned it a value.
Hope clarified the confusion.
Regards,
Abdul Rehman.
[ November 23, 2006: Message edited by: Abdul Rehman ]