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

Home > Java Programming > Exceptions > Questions and Answers

Q: What is the result of executing the following code, using the parameters 0 and 3 ?

public void divide(int a, int b) {
try {
int c = a / b;
} catch (Exception e) {
System.out.print("Exception ");
} finally {
System.out.println("Finally");
}
A. Prints out: Exception Finally B. Prints out: Finally
C. Prints out: Exception D. Compile with error

Answer and Explanation

Answer:Compile with error

Explanation:
 Finally block always executed whether exception occurs or not.

0/3 = 0 Does not throws exception.

Comment on this Question

Name:

Loading...




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