Java – The ? Operators

Home/Java - Tutorial/Java - Operators/Java – The ? Operators
Java – The ? Operators 2017-06-13T09:50:13+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