Java Conditionals Flashcards
used in selecting one of many code blocks to be executed.
switch statement
breaks out of the switch
block. This stops the execution of more code, and case testing in the block.
break statement
If there is no case match, the codes to be run
are specified in the __. A break is
no longer needed in this statement, because it
is the last statement in the switch block.
default block / default keyword
To combine multiple conditions depending on
your desired results,
Logical operators
A unary logical operator and simply negates its value:
The NOT (!) Operator
A binary logical operator that returns true if at least one of the operands is true, otherwise it will return false.
The OR (||) Operator
A binary logical operator that returns true if all of the operands is true, otherwise it will return false.
The AND (&&) Operator
gives us the character at
index 0, the first character of the word, specifically, the
character we need since the user is expected to enter just a character.
charAt(0)