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].
答案:D
解析:
變數或物件 = <判斷條件> ? <true時的值> : <false時的值>
0 意見:
張貼留言