Skip to content
Quiz · Exceptions · lesson 5 of 12

Quiz — try, catch and finally

What does the program print?

JAVA
public class Main {
    public static void main(String[] args) {
        try {
            int n = Integer.parseInt("x");
            System.out.print(1);
        } catch (NumberFormatException e) {
            System.out.print(2);
        } finally {
            System.out.print(3);
        }
    }
}