Mahesh G P wrote:My query is "If variable is not initiazlied won't it be null"?
even the declaration wont be in .class file . i.e compiler removes String str; if str doesnt have assigment further lines.
So, checking str have further assignment logic in compiler may be not smart enough to prevent error that you get now ;)
<edit>*context is about local variable</edit>