The reason the first code gives error is.....
"a" is non-final varible means it can change its value later....
And the compiler know that if the if condition fails "b" will not be initilaized.So error says "using before initilzing"
In the second case "a" in final and compiler can be sure that the value will not change and the "b" variable WILL be initialized
SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !