Foo foo = null; /* null just in case... */ if(someCondition) { foo = createFoo(); } else { // whoops! forgot to initialise foo in this case // This is a logic bug... } foo.doStuff(); // ...but the compiler won't pick it up