Home » Interview » Technology

class Hell { public static void main(String[] args) { Integer i = 42; String s = (i<40)?"life":(i>50)?"base":"ball"; System.out.println(s); } }

Correct Answer: ball

Explanation:

D is correct. This is a ternary nested in a ternary with a little unboxing thrown in.Both of the ternary expressions are false.


← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion