AP® Computer Science A glossary

Relational operators

Also called: comparison operators

Course: AP® Computer Science A Shows up in: Unit 2: Selection and Iteration

The operators ==, !=, <, >, <= and >=, which compare two values and evaluate to a Boolean value.

Appears in the course and exam description (CED): 2.2.A.12.2.A.22.2.A.3

<, >, <= and >= compare numeric values. == and != check whether two values are the same: with primitive types they compare the values, and with reference types they compare the object references.

System.out.println(7 / 2 > 3);
System.out.println(5 != 4);

Output:

false
true
Learn it properly, with a checkpoint 2.2 Boolean Expressions

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure