Originally posted by Campbell Ritchie:
I never knew compilers could change colour.
Local variables usually keep their values on a stack rather than on the heap, so there is a risk that a previous value on the stack will be read rather than a default value. The compiler therefore insists every local variable be explicitly initialised.
Thanks Campbell.
( Change in compiler color means the compile time error (doesn't sound good)).
Anyways,
Its true that local variables are stack/automatic variables and lives in the method stack.
It will be great if you please elaborate "a previous value on the stack will be read rather than a default value."
Thanks