public class exceptions
{
public static void main(String Args[])
{
int[] array = new int[3];
try
{
for(int a=0;a<4;++a)
{
array[a] = a;
}
System.out.println(array);
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Out of bounds");
}
}
}
In the above code, the line System.out.println(array); gets skipped when an exception occurs. Write a finally block that will execute, and will execute a System.out.println(array); if there is an exception.
Correct Answer:
Verified
{...
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q65: import java.util.*;
import java.util.Scanner;
public class AssertionExample
Q66: What are unchecked exceptions? Give an example.
Q67: import java.util.*;
public class DivisionMistakeCaught3
{
public
Q68: An alternative to hard coding error messages
Q69: Q71: Q72: What advantages does object-oriented exception handling provide? Q73: What is unreachable code and how might Q74: Q75: Unlock this Answer For Free Now! View this answer and more for free by performing one of the following actions Scan the QR code to install the App and get 2 free unlocks Unlock quizzes for free by uploading documents