>> Amit
Your interpretation is not correct I feel. Did you compile the code? I think the compiler will reject the third last line!!
Amit try compile the following code you will get a very intersting result. Which is some what similar to the point you are trying to highlight.
public static void main(
String [] args) {
System.out.println(mostPopularMethodInTheWorld());
}
public static boolean mostPopularMethodInTheWorld() {
while (true) {
try {
return true; // Do you expect the JVM to finish this line ever?? NO
} finally {
break;
}
}
return false;
}
Output will be : false
Reason : The commented line will never be completed by the JVM as the procedure never gets a chance to execute the ret instruction due to the abnormal exitation of the procedure(finally clause in another words) itself. JVM will never come back to finish the commented line!!
I think you have to put something like following to get your code compiled for the third last line.
return null; //Say,
Then the object will be elligible for garbage collection after the execution of that statement. This is the first and the last return statement that JVM completes.
Hope that would clear your doubts.
Regards,
Priyanka.