2.4. Operators

[3.1] Use Java operators; including parentheses to override operator precedence

In this section, you’ll use different types of operators—assignment, arithmetic, relational, and logical—to manipulate the values of variables. You’ll write code to determine the equality of two primitive data types. You’ll also learn how to modify the default precedence of an operator by using parentheses. For the OCA Java SE 8 Programmer I exam, you should be able to work with the operators listed in table 2.9.

Table 2.9. Operator types and the relevant operators

Operator type

Operators

Purpose

Assignment =, +=, -=, *=, /=, %= Assign value to a variable
Arithmetic +, -, *, /, %, ++, -- Add, subtract, multiply, ...

Get OCA Java SE 8 Programmer I Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.