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

Home > Java Programming > Exceptions > Questions and Answers

Q: 1. What will be the output of the program?
public class X{
public static void main(String [] args) {
try {
badMethod();
System.out.print("A");
}catch (Exception ex){
System.out.print("B");
}finally{
System.out.print("C");
}
System.out.print("D");
}
public static void badMethod() {}


A. AC B. BC 
C. ACD D. ABCD

Answer and Explanation

Answer:ACD

Explanation:
There is no exception thrown, so all the code with the exception of the catch statement block is run.

Comment on this Question

Name:

Loading...




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