单项选择题
import java.io.IOException;
public class ExceptionTest(
public static void main (String[]args)
try (
methodA();
) catch (IOException e) (
system.out.printIn(“Caught IOException”);
) catch (Exception e) (
system.out.printIn(“Caught Exception”);
)
)
public void methodA () {
throw new IOException ();
}
What is the result?()
A. The code will not compile.
B. The output is caught exception.
C. The output is caught IOException.
D. The program executes normally without printing a message.
相关考题
-
单项选择题
public class foo { public static void main (string[]args) try {return;} finally {system.out.printIn(“Finally”);} } What is the result?()
A. The program runs and prints nothing.
B. The program runs and prints “Finally”
C. The code compiles, but an exception is thrown at runtime.
D. The code will not compile because the catch block is missing. -
多项选择题
switch (i) { default: System.out.printIn(“Hello”); ) What are the two acceptable types for the variable i?()
A. Char
B. Byte
C. Float
D. Double
E. Object -
单项选择题
int i= 1, j= 10 ; do ( if (i++> --j) continue; ) while (i<5); After execution, what are the values for I and j?()
A. i = 6 and j= 5
B. i = 5 and j= 5
C. i = 6 and j= 4
D. i = 5 and j= 6
E. i = 6 and j= 6
