-
Calculating Age! Using our new Enum in a Switch Expression
When using an enum in a switch expression, we must supply logic for all possible values (an exhaustive listing). Lets use our new AgeUnits enum in a switch expression to determine the age.
-
Switcharoo! The Java Switch Statement
In Java, a switch statement can examine possible values for a single variable and either make assignments or perform actions based upon that variable’s value.
-
Condition and Assignment All In One Statement – The Ternary Operator
A quick discussion about the ternary operator (both condition and assignment in one command) in Java.
-
If only! Let’s Talk Conditions
In Java, we can use statements like the following to control what portions of the code are executed: – if-then – if-then-else Our conditions can be simple tests or they can be chains of tests strung together to make one overall result.