From Andrew:
Please quote your sources.
We have reason to believe this was from an illegal source. Since we do not have any information to the contrary, we have deleted this question. Further questions posted without source details may be deleted without any investigation.
Thanks, Andrew
Originally posted by Gaurav Bhatia:
Please check the sample code written below :
public class ReturnExample
{
private String normalExecution()
{
String result = "";
try
{
result = "Entered try block.";
return result;
}
catch(Exception e)
{
result = result + "Entered Catch block.";
return result;
}
finally
{
result = result + "Entered finally block.";
}
}
public static void main(String[] args)
{
ReturnExample example = new ReturnExample();
String result = example.normalExecution();
System.out.println(result);
}
}
Why is the result of the program being printed as �Entered try block�.
Although finally block gets executed but the returned value from the function call only contains the string value set in the try block and doesn�t includes the changes done in finally block.
Thanks!!
.NOTE:
just because a class is described as "thread-safe, doesn't meant that it is always thread-safe"
.[B] relates to Wrapper Classes which, as we know, are marked final [/B]