Flashcards
Conditional Operators and Statements
Cards in this deck (21)
- 1==equals
- 2<=smaller than or equals to
- 3>=greater than or equal to
- 4!=does not equal
- 5<smaller than (exclusive)
- 6>greater than (exclusive)
- 7||or
- 8&&and
- 9syntax of an if/else statementif(condition)
{
statements;
}
else
{
statements;
} - 10Syntax of a switch & case statementswitch(variable){
case value: statements;
break; //optional
case value: statements;
...
} - 11Which 'if' will the 'else' pair up with? if(statement){ if(statement){ else{ } } }if(statement){
if(statement){ //this one
else{
}
}
} - 12What 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)
- 13else 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
} - 14Optional statements added after an 'if' statementelse, else if
- 15syntax for a nested 'if' statementif(condition){
if(condition){
}
} - 16What is this equivalent to? !(A && B)!(A) || !(B)
- 17What is this equivalent to? !(A || B)!(A) && (B)
- 18De Morgan's Lawnot(A or B) == (not A) and (not B)
as well as
not(A and B) == (not A) or (not B) - 19break statementexits a switch statement
- 20default statementused at the end of a switch statement, takes all values, implies that other cases weren't reached
- 21case groupsmultiple cases that all run the same statement in a switch
Information
- Description
- Flashcards for conditional and relational operators/statements in java
- Created by
- nini798
- Views
- 63
- Tags
- Rating