[Solved] Try/catch statement jumps to end of program [closed]


Try this.

public static void main(String[] args) {
    Robot robot = null;
    try {
        robot = new Robot();
    } catch (AWTException e) {
        e.printStackTrace();
    } catch (Throwable th) {
        th.printStackTrace();
    } 
}

The problem is almost certainly that some exception other than AWTException is being thrown. (My money, since you’re a self-described noob, is on NullPointerException.) Anyway, nothing will throw past this: Not all things that can be thrown are children of Exception, but they are all children of Throwable.

solved Try/catch statement jumps to end of program [closed]