Booleans, Logical and Comparison Operators
Booleans, Logical and Comparison Operators
Comparison and
Logical Operators
in Java
Computing
Why are booleans
important in Java?
Driving Question
3
“PDN
In pairs come up with
different sets of booleans.
Using binary numbers,
determine the values of the
booleans.
”
4
“
Booleans, Comparison
and Logical Operators
are very important in any
programming language and
they help us take decisions
based on certain conditions.
”
5
Lesson objectives
Booleans
Booleans
Boolean is a system of logical thought that creates
true or false statements. In computing, a Boolean is
a result that can only be true or false.
Boolean expressions use operators like AND, OR,
XOR, and NOT to compare values and return a true
or false result. For example, the AND operator
requires both terms to be in each item returned.
The OR Boolean only requires one or the other.
9
Comparison Operators
Comparison Operators
12
Logical Operators
Logical Operators
17
x y x && y
true true true
true false false
false true false
false false false
18
x y x || y
true true true
true false true
false true true
false false false
20
x !x
true false
false true
22
Exit Ticket
References
www.w3schools.com
www.codehs.com
https://booleangame.com/