Another little peculiarity that can come up on questions is the placing of the default statement. The conventional place for the default statement is at the end of of case options. This approach mirrors the way most people think. Once you have tried the other possibilities, you perform the default output. As mentioned previously an if statement can only take a boolean type and a switch can only take a byte , char, short or int.
Some programmers claim that the ternary operator is useful.
I do not consider it so. It is not specifically mentioned in the objectives so please let me know if it does come up in the exam. An if statement must evaluate to a boolean value and thus b meets this criterion. Because b is a boolean there was no error caused by the if statement. If b was of any other data type an error would have occured as you attempted to perform an assignment instead of a comparison.