What will the following code fragment type:

try {
    int i = 5;
} catch (Exception e) {
    System.out.print("catch");
} finally {
    System.out.print("finally");
}
Explanation
The finally block is executed in any case, no matter what code is in a try block

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes