单项选择题
Given:
String[] elements = { "for", "tea", "too" };
String first = (elements.length > 0) ? elements[0] : null;
What is the result?()
A.Compilation fails.
B.An exception is thrown at runtime.
C.The variable first is set to null.
D.The variable first is set to elements[0].
相关考题
-
单项选择题
Given two files, GrizzlyBear.java and Salmon.java: If both classes are in the correct directories for their packages,and the Mammal class correctly defines thefindSalmon() method, which change allows this code to compile?()
A.add import animals.mammals.*; at line 2 in Salmon.java
B.add import animals.fish.*; at line 2 in GrizzlyBear.java
C.add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java
D.add import animals.mammals.GrizzlyBear.*; at line 2 in Salmon.java B -
单项选择题
Given: When line 14 is reached, how many objects are eligible for the garbage collector?()
A.0
B.1
C.2
D.3
E.4 -
单项选择题
Given: What is the result?()
A.Compilation fails.
B.An exception is thrown at runtime.
C.doStuff x = 6 main x = 6
D.doStuff x = 5 main x = 5
E.doStuff x = 5 main x = 6
