If you want a program to stop when an exception is
thrown, you use exit
a class method of the System
class,
to which you supply an argument of 0
:
catch (IOException e) { System.exit(0); }
When executed, the exit
statement terminates the
program and returns
its argument either to the calling program or, if there is no calling
program, to the operating system. By general convention, an argument of
0
is taken by the calling program or the operating system to mean
that no special action is to be taken.