Q. What is the result of the following code snippet?

try {
String str = "Java";
int num = Integer.parseInt(str);
} catch (NumberFormatException e) {
System.out.println("NumberFormatException!");
} catch (Exception e) {
System.out.println("Exception!");
} finally {
System.out.println("Finally Block!");
}

  • (A) Finally Block!
  • (B) NumberFormatException! Finally Block!
  • (C) Compilation error
  • (D) Exception Block!
πŸ’¬ Discuss
βœ… Correct Answer: (B) NumberFormatException! Finally Block!

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
191
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Sandhya Thakur
Publisher
πŸ“ˆ
87%
Success Rate