Question 1
What exception type does the following program throw?
public class Test {
public static void main(String[] args) {
| System.out.println(s.charAt(3)); |
}
}
◦ 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) {
| Object o = new Object(); |
}
}
◦ ArithmeticException
◦ ArrayIndexOutOfBoundsException
◦ StringIndexOutOfBoundsException
◦ ClassCastException
◦ No exception