16
Loading subject content…
Loading subject content…
Loading practice questions…
What is the output of the following program?
public class Main {
public static void main(String[] args) {
try {
Integer.parseInt("12a");
} catch (NumberFormatException e) {
System.out.println("bad number");
}
}
}What is the output of the following program?
public class Main {
public static void main(String[] args) {
try {
String s = null;
s.length();
} catch (NullPointerException e) {
System.out.println("NPE");
}
}
}What is the output of the following program?
class Main {
static int f() {
try { return 1; } finally { System.out.print("F"); }
}
public static void main(String[] args) { System.out.println(f()); }
}