it wouldn't, that's why the answer doesn't include alternative 3
Joined: Nov 22, 2008
The answer 3) would not be correct even if int iam is initialized. The local variable has to be final in order to be accessed by the inner class. My question is whether this question should be in the "errata"?
Howard, A local var inside a method / any block of code / constructor need not to be initialized during declaration itself. The compiler will complain when you access it's value before initializing it. Try to put a System.out.println(iOther); statement in this method before initializing the var. Now the compiler WILL shout. regds maha anna