3. Write the exception thrown by the following code block?
Integer[][] ints = { {1,2,3}, {null}, { 7,8,9} };
System.out.println("value = " + ints[1][1].intValue();
Answers
Answered by
0
Explanation:
By using a try-catch-finally statement:
try {
// ...
} catch (ExceptionType1 ex) {
// ...
} catch (ExceptionType2 ex) {
// ...
} finally {
// ...
}
The block of code in which an exception may occur is enclosed in a try block. This block is also called “protected” or “guarded” code.
If an exception occurs, the catch block that matches the exception being thrown is executed, if not, all catch blocks are ignored.
The finally block is always executed after the try block exits, whether an exception was thrown or not inside it
Hope it helps to u...
Similar questions