Click here to Skip to main content
15,886,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Color back = minaSelec ? Color.RED : Color.LIGHT_GRAY;


What does it means the "?"
Posted
Comments
fjdiewornncalwe 18-May-11 10:46am    
Just as an addition to John's answer. This is called a ternary operator.

it's the same as doing this:

Java
Color back;
if (minaSelec)
{
    back = Color.RED;
}
else
{
    back = Color.LIGHT_GRAY;
}
 
Share this answer
 
Comments
fjdiewornncalwe 18-May-11 10:46am    
+5.
(part one) ? (part two) : (part three)


that mean if part one is true. Execute part two. Else execute part three.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900