String[] elements = { "for", "tea", "too" }; 
String first = (elements.length > 0) ? elements[0] : null;    

What is the result?

  1. Compilation fails

  2. An exception is thrown at runtime

  3. The variable first is set to null

  4. The variable first is set to elements[0]


Correct Option: D

Find more quizzes: