...
| Code Block | ||
|---|---|---|
| ||
public String processStrings(String[] strings) {
String result = "";
try {
for (int i = 0; i < strings.length; i++) {
result = result.concat( processString( strings[i]));
}
} catch (ArrayIndexOutOfBoundsException e) {
// handleHandle error
}
return result;
} |
Technically this code need not catch ArrayIndexOutOfBoundsException because it is a runtime exception. In fact, this code should not catch ArrayIndexOutOfBoundsException unless the method has a particular way of handling it (that differs from handling any other exception class). Otherwise, this code should just let the exception propagate up the call stack.
...