Found this question here
And I can't understand, why on first case it prints CoolReturn+1 and on second case CoolReturn? How does it work?
Thanks
====================
What will be printed?
public void testFinally(){
    System.out.println(setOne().toString());
}
protected StringBuilder setOne(){
    StringBuilder builder=new StringBuilder();
    try{
        builder.append("Cool");
        return builder.append("Return");
    }finally{
        builder.append("+1");
    }
}
Answer: CoolReturn+1
A bit more difficult:
public void testFinally(){
    System.out.println(setOne().toString());
}
protected StringBuilder setOne(){
    StringBuilder builder=new StringBuilder();
    try{
        builder.append("Cool");
        return builder.append("Return");
    }finally{
        builder=null;  /* ;) */
    }
}
Answer: CoolReturn
 
     
     
     
     
     
     
     
    