![]() |
Home | Unit 1 | Unit 2 | Unit 3 | Unit 4 | Unit 5 | Unit 6 | Unit 7 | Unit 8 | Unit 9 | Reflection |
Unit 3
My notes on unit 3.
Booleans
Either true or false.
Operations are the same as in any other programming language with things like >, ==, etc.
Just as in most other languages, you have standard control flow (if, else if, else)
Vocab
Relational Operators compare two values (==, >, !=, etc)
- Do note that for reference types you must use
.equalTo()and.compareTo()
Compound Boolean Expressions have multiple conditions joined together (using things like &&, ||, and !)
De Morgan’s Law
!(a && b) can be simplified to !a || !b
!(a || b) can be simplified to !a && !b
Boolean Logic Visualizer
A
false
B
false
Operator Results:
Truth Table:
| A | B | A AND B | A OR B | A XOR B | NOT A |
|---|---|---|---|---|---|
| false | false | false | false | false | true |
| false | true | false | true | true | true |
| true | false | false | true | true | false |
| true | true | true | true | false | false |
