why instance variables are initialized to null, but not local variables
That's a good question - my guess is that it's that way due to the expense of doing code path analysis for a class against inline code. If you declare a class with an uninitialised public member variable, javac would have to do code path analysis on the class every time it was used. Compromises are never fully satisfying for everyone!
I'd never really been conscious before that variables were initialised in classes and not in local code, and I use that declare-uninitialised, complicated-initialisation-block pattern a lot
. I think I might be on auto-pilot while I'm writing local code.