Java's Conditional Operator ? :

value = UserSetIt ? UsersValue : DefaultValue;

is equivalent to:

if(UserSetIt)
  value = UsersValue;
else
  value = DefaultValue;
Consider the types of the variables involved.
double scale = halveIt ? 1 : 0.5;
The types of the second and third operands must be the same as, or assignable to, the type of the value (ie the left side of the = sign).
This page's parent within this Web Site. About this Web Site. Its home page. Email its Author.