Skip to content
Quiz · Exceptions · lesson 7 of 12

Quiz — throws forgotten

What happens when this program is compiled and run?

JAVA
public class Main {
    static void fail() { throw new Exception("boom"); }
    public static void main(String[] args) {
        try {
            fail();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}