posted 14 years ago
The local variable should be initialized before they are used. The compiler will evaluate this value in all possible ways, that it thinks. And since we know that, in the above code, you initialized the variable y in all logically possible way with a poor if conditions, that's way it flags Compilation Error, saying that the variable y may not be initialized, if you change the as follows, you won't get Compilation Error. because you initialized the variable y in all the possible ways, that it thinks!
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|