Home Does finally always execute in Java?
Reply: 0

Does finally always execute in Java?

user385
1#
user385 Published in June 20, 2018, 10:52 pm

Considering this code, can I be absolutely sure that the finally block always executes, no matter what something() is?

try {  
    something();  
    return success;  
}  
catch (Exception e) {   
    return failure;  
}  
finally {  
    System.out.println("i don't know if this will get printed out.");
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.464123 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO