Computer Applications

Predict the output of the below Java program snippet:

int c = (3<4)? 3*4:3+4;

Java

Java Operators

68 Likes

Answer

12

Working

As 3 is less than 4 so condition of ternary operator is true. Variable c is assigned the value of expression 1 which is 3 * 4 = 12.

Answered By

33 Likes


Related Questions