Write an expression using the conditional operator (? :) that compares the values of the variables x and y. The result (that is the value) of this expression should be the value of the larger of the two variables.

Write an expression using the conditional operator (? :) that compares the values of the variables x and y. The result (that is the value) of this expression should be the value of the larger of the two variables.

LANGUAGE: JAVA

CHALLENGE:

Write an expression using the conditional operator (? 🙂 that compares the values of the variables x and y. The result (that is the value) of this expression should be the value of the larger of the two variables.

SOLUTION:


(x < y ? y : x)

Add comment