-
What is the output of this program?
public class exceptionHandling_Example
{
public static void main(String args[])
{
try
{
int n = args.length;
int n1 = 9 / n;
System.out.print(n);
try
{
if (n == 1)
n = n / n - n;
if (n == 2)
{
int s = {1};
s[8] = 9;
}
}
catch (ArrayIndexOutOfBoundException e)
{
System.out.println("Hello");
}
catch (ArithmeticException e)
{
System.out.println("Java");
}
}
}
}
-
- Runtime Error
- Compilation Error
- First
- Second
- None of these
Correct Option: B
Compilation Error
error: 'try' without 'catch', 'finally' or resource declarations
try
^
1 error