
Java provides an exception-handling mechanism that helps you build robust code. When
an error occurs at runtime, an exception is thrown. It is possible for an application to catch
this exception and, in many cases, recover from it.
6.1 Exception Handling
The Multiply class, which we have seen in Chapter 1, multiplies two integers supplied as
arguments and outputs the result.
Multiply
1 public class Multiply {
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
}
public static void main(String[] args) {
String resultString;
int argl;
int arg2;
int result;
argl = Integer.parselnt(args[0]);
arg2 = Integer.parselnt(args[l]); ...