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

Home > Java Programming > Exceptions > Questions and Answers

Q: class A{
public static void main(String args[]){
try{
System.out.println(“one”);
System.exit(0);
}catch(Exception e){
System.out.println(“two”); }
finally{
System.out.println(“three”); 
}
}
}
A. one , two , three B. one , three
C. one   D. compile time error

Answer and Explanation

Answer:one  

Explanation:
In the above program inside a try block they have used System.exit(0), if you use this code then rest of the code will get skipped from the execution.
So c) is correct answer.

Comment on this Question

Name:

Loading...




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