Java – The ? Operators

Java – The ? Operators 2017-08-09T09:51:19+00:00

It is also known as ternary operator or conditional operator.

expression1 ? expression2 : expression3

b = a < 0 ? -a : a;

EX.

 


Output :
The Absolute value of 50 is 50
The Absolute value of -10 is 10

Prev Next