1: class Foo { 2: public static void main(String[] args) { 3: Integer i = 42; 4: String s = (i < 40) ? "life" : (i > 50) ? "universe" : "everything"; 5: System.out.print(s); 6: } 7: }
if (i < 40) { //false return "life"; } else if (i > 50) { //false return "universe" } else { return "everything" }
Login in to like
Login in to comment
or Read more about Java Quizzes
Login in to like
Login in to comment