Question | Answer |
== | equals |
<= | smaller than or equals to |
>= | greater than or equal to |
!= | does not equal |
< | smaller than (exclusive) |
> | greater than (exclusive) |
|| | or |
&& | and |
syntax of an if/else statement | if(condition) { statements; } else { statements; } |
Syntax of a switch & case statement | switch(variable){ case value: statements; break; //optional case value: statements; ... } |
Which 'if' will the 'else' pair up with? if(statement){ if(statement){ else{ } } } | if(statement){ if(statement){ //this one else{ } } } |
What data types will work with the variable creating a switch? | int, byte, short, char, String (other types, but not very relevant to this class, are enumerated types and classes that "wrap" primitive data types, such as Integer, Byte, Short, Character) |
else statements pair up with: | the closest if statement that's available. (not available means that the if statement is locked outside of brackets of another, outer 'if' statement. See example below: if(statement){ //locking bracket if(statement){ } } //locking bracket else{ //outside of bracket } |
Optional statements added after an 'if' statement | else, else if |
syntax for a nested 'if' statement | if(condition){ if(condition){ } } |
What is this equivalent to? !(A && B) | !(A) || !(B) |
What is this equivalent to? !(A || B) | !(A) && (B) |
De Morgan's Law | not(A or B) == (not A) and (not B) as well as not(A and B) == (not A) or (not B) |
break statement | exits a switch statement |
default statement | used at the end of a switch statement, takes all values, implies that other cases weren't reached |
case groups | multiple cases that all run the same statement in a switch |
Want to create your own Flashcards for free with GoConqr? Learn more.