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.
What will be an ideal response?
finally{ System.out.println(array);}
Computer Science & Information Technology
You might also like to view...
A document ________ is a collection of coordinating fonts, colors, and special effects
A) layout B) theme C) style D) template
Computer Science & Information Technology