Skip to content
CodeKruPro

return inside try with a finally block

Predict the outputEasy-MediumJava only
Main.java
public class Main {
    static int f() {
        try {
            System.out.println("try");
            return 1;
        } finally {
            System.out.println("finally");
        }
    }

    public static void main(String[] args) {
        System.out.println(f());
    }
}

Graded by exact match. Spaces at the ends of lines and blank lines at the end do not count.

to answer and keep your progress. Reading is free for everyone.