Search your topic in Java2share
Home > FAQs
eXTReMe Tracker


Exception Handling FAQs


.style1 { color: #800000; font-weight: bold; } .style2 {color: #0000FF} --> Untitled Document

Q13. Is it possible to take try without catch?
Ans.  Yes, it is possible to take try without catch but compulsory finally block should be available.

Q14. What is the purpose of finally block?
Ans.   The main purpose of finally block is, to maintain the cleanup code. This block will execute always.

Q15.  Is finally block will be execute always?
Ans.  Yes finally block will be executed always irrespective of whether exception raised or not raised whether exceptions are handled or not handle. There is one situation where the finally block won’t be executed if the JVM is going to be shutdown.

Q16. In which situation finally block will not executed?
Ans. There is one situation where the finally block won’t be executed if we are using system.exit(0) explicitly then JVM itself will be shutdown and there is no chance of executing finally block.