Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
finally clause
subramanian annamalai
Greenhorn
Posts: 22
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
PLease clarify me whether there are any scenario's in which finally clause associated with the try block will not run.
Thanks in advance
Subu
Francisco Gonzalez
Greenhorn
Posts: 15
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Finally clause won't execute whenever there is a JVM shutdown. This can be when for example there is an OutOfMemoryError or when in the try block there is a System.exit(int) call.
Regards,
Francisco
Francisco Gonzalez
Greenhorn
Posts: 15
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You could try this code that gives you one scenario:
public class Finally { public static void main(String[] args) { try { System.out.print("try "); System.exit(1); } finally { System.out.println("finally block executed"); } } }
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
can anyone answer this problem
How do you close the JDBC connection back to the Connection pool?
NX: (Contractors) Error handling between lock/unlock
Try Catch Finally - Voodoo Question
try/catch question
More...