Comparison Operators- compares two values and will evaluate to either true or false
Comparison | Java Symbol | less than | < | greater than | > | equal to | == | not equal to | != | less than or equal to | <= | greater than or equal to | >= |
Logical OperatorsLogical operators are operators that operate on Boolean values -- that is values that are true of false.
Logical Operator | Java symbols | Truth Table | And | && | | Or | || | | Not | ! | |
Boolean Expressions- boolean is a primitive java data type
- a Boolean expression is an expression that evaluates to either true of false
- true and false are both reserved words in java
- Boolean expressions are made up of comparison and logical operators
- boolean expressions can be used in the if statements and conditional loops
- boolean expressions can also be used is assignment statements
Sample Boolean expressions: - age > 16
- myAge != yourAge
- ((age >16) && (sex == "F"))
- !isWorking
|
|