| A | B |
| Flow of control | Order in which a program performs actions |
| Branching statement | Chooses between 2 or more possible actions |
| Loop statement | Repeats an action until a stopping condition occurs |
| char Type | 'x' represents a character in char type. Example: char a --> a = 'b' --> System.out.println(a) --> output would be: b |
| Difference between println() method and print() method | println() method advances to a new line after it displays its output. Print() method does NOT advance to a new line. Instead, to make it advance, do this: System.out.print("this is a string\n "); |
| ! (not) | Syntax rule: !(expression). Will be TRUE if expression is FALSE. Don't use this because it's confusing! Instead of !(cost == 3) try (cost != 3) |
| What if you need ONE expression out of MANY to be true? | || (or). Syntax rule: (expression) || (expression), ie. (I've had food) || (time > 7). Will be true if EVEN ONE expression is true. |
| What if you need multiple expressions to be true? | && (and). Syntax rule: (expression) && (expression), ie. (time < 7) && (I made food). Will only be true if ALL statements are true |
| Syntax for IF statement | if (boolean expression) {statements} |
| Boolean expressions | Combination of values/variables by comparison operators. Value can only be TRUE/FALSE. |
| Expressions | Can be a variable, value, or a combination of made up values, variables and operators |
| Arithmetic expressions | Combination of numbers with a number value. Ex. 10, taxRate/100, (cost*tax) |
| String expressions | Combination of strings with a string value. Ex. "Hello," "total cost is" + totalCost |
| Java comparison operators: Equal to | Java notation: == |
| Java comparison operators: NOT equal to | Java notation: != |
| Java comparison operators: Greater than | Java notation: > |
| Java comparison operators: Greater than or equal to | Java notation: >= |
| Java comparison operators: Less than | Java notation: < |
| Java comparison operators: Less than or equal to | Java notation: <= |
| if-else statements | Program checks to see if the if statement in () is T/F. If its TRUE the statement BEFORE the else is executed. If it's FALSE the statement AFTER the else is executed. Ex. if (balance >=0) balance = balance+interest rate; else balance = balance-overdraft |