Welcome Guest | Sign in | Register
Exceptions - Discussion Page For Q.2614 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Exceptions > Questions and Answers

Q: Given:

1. // some code here
2. try{
3. // some code here
4.} catch (SomeException se) {
5. // some code here
6.} finally {
7. // some code here
8.}

Under which three circumstances will the code on line 7 be executed? (Choose three.)
A. The instance gets garbage collected.
B. The code on line 3 throws an exception.
C. The code on line 5 throws an exception.
D. The code on line 1 throws an exception.
E. The code on line 3 executes successfully.

A. A,B,C B. B,C,E
C. A,B,E D. C,D,E

Answer and Explanation

Answer:B,C,E

Explanation:
When finally block will execute, as we know if no exception occurs (means in 3 line) then directly finally block will execute.
If exception occurs then try, catch, finally (means line 3 as well as 5) block will execute.
Or else directly after 1 line finally block will execute.
So A) is correct.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.