Possible Duplicate:
What is the Java ?: operator called and what does it do?
hi, may i know what is the java ?: operator called, i am trying to find information on how it works but i do not know what is it called, typing ?: in google dont give a correct result.
It's the conditional operator.
Some people call it the ternary operator, but that's really just saying how many operands it has. In particular, a future version of Java could (entirely reasonably) introduce another ternary operator - whereas the name of the operator is the conditional operator.
See section 15.25 of the language specification:
The conditional operator ? : uses the boolean value of one expression to decide which of two other expressions should be evaluated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With