CIS 160 Conditional operator
- use the conditional operator (inline selection, ?:)
- ?:
- only ternary operator in Java
- operates like an inline if/else
- expr1 ? expr2 : expr3
if expr1 is true, the whole thing is replaced by expr2,
otherwise it is replaced by expr3
- grossPay = hours>40 ? rate*40 + (hours-40)*rate*1.5 : hours*rate;