Can anyone tell me what the "?" and ":" mean in the following statement?
int y = (x < 100) ? (z > 1 ) ? 4 : 3 : 2;
Printable View
Can anyone tell me what the "?" and ":" mean in the following statement?
int y = (x < 100) ? (z > 1 ) ? 4 : 3 : 2;
That's the ternary operator.
which is the ternary operator?
can you explain what the "?" and ":" do?
I could, but google can explain it a lot better than I can. I'd recommend starting with a search for something like "java ternary operator". Read up on that, and if you're still confused, you can ask a more specific question.