I tried writing some jshell scripts. When an exception is thrown, jshell still goes on to execute the next line.
How can I make my scripts behave more like normal java programs?
Edit: I simply run it like jshell SCR.jsh.
Using throw new Exception() or 1/0 does not prevent the next line from being executed.
The script includes statement like this:
System.out.println(1/0)
System.out.println("foo")
/exit
I thought the second line is unreachable. That's what I expected. But after the exception is printed, foo is also printed.