What RuntimeException will the following programs throw, if any?
(a)
public class Test {
public static void main(String[] args) {
System.out.println(1 / 0);
}
}
(b)
public class Test {
public static void main(String[] args) {
int[] list = new int[5];
System.out.println(list[5]);
}
}
(c)
public class Test {
public static void main(String[] args) {
String s = "abc";
System.out.println(s.charAt(3));
}
}
(d)
public class Test {
public static void main(String[] args) {
Object o = new Object();
String d = (String)o;
}
}
(e)
public class Test {
public static void main(String[] args) {
Object o = null;
System.out.println(o.toString());
}
}
(f)
public class Test {
public static void main(String[] args) {
System.out.println(1.0 / 0);
}
}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.