posted 22 years ago
Hi Scott,
In the first code snippet, you are trying to print the value before it is initialized (its initialization is conditional , which may in turn false and there may be no initialization) try this code:
===========================================================
int i;
final int j=2;
if(j==2)i=0;
System.out.println(i);//this compiles OK
===========================================================
Here the variabale j has a final value and it behaves as constant, so the initialization of i is guaranteed (in this condition) and it will compile and execute.
HTH
--Farooq
Muhammad Farooq<br />Sun Certified Programmer for Java 2 Platform<br />Oracle8i Certified Professional Database Administrator