Question:What is the result of an attempt to compile and run the given program?
public class Test107 { public static void main(String[] args) { System.out.println(test()); } private static int test() { return (true ? null : 0); } }
A It gets a compiler error, because of an attempt to return null from the method with return type "int".
B It compiles, but throws NullPointerException at run-time.
C It compiles, runs, and prints "null" (without quotes).
D It compiles, runs, and prints "0" (without quotes).
+ AnswerB
+ Report