You need to initialize local variables before they are used as below
public void method() {
Object o=null;
try {
o = new Object();
} catch (Exception e) {
handleError();
}
doSomething(o);
}
You will not get the compilation failure until you use local variable which was not initialized