A



Computer Programming I Instructor: Greg Shaw

COP 2210

Relational Operators and Expressions

← A boolean expression is anything that evaluates to true or false

← One kind of boolean expression is the relational expression

← A relational expression compares two quantities for one of 6 possible relationships

← The syntax of a relational expression is

quant1 operator quant2

where quant1 and quant2 are expressions, and

operator is one of the relational operators

|Relational Operators |

|Algebra |Java |Meaning |

|< |< |less than |

|≤ | |> |greater than |

|( |>= |greater than or equal to |

|= |== |equals |

|( |!= |does not equal |

← Examples of relational expressions

count > 0

amountDue == amountTendered

Math.pow(b,2) – 4 * a * c < 0

← See document, “The if Statement”

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download