Question 1
What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
| System.out.println(1 / 0); |
}
}
◦ ArithmeticException
◦ ArrayIndexOutOfBoundsException
◦ StringIndexOutOfBoundsException
◦ ClassCastException
◦ No exception
Question 2
What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
| int[] list = new int[5]; |
| System.out.println(list[5]); |
}
}
◦ ArithmeticException
◦ ArrayIndexOutOfBoundsException
◦ StringIndexOutOfBoundsException
◦ ClassCastException
◦ No exception