Java Operators and expression statements
This module discusses how operators are a fundamental element from which Java expressions and statements are built.
The certification exam recognizes the importance of operators and contains a number of questions that call upon your knowledge of them.
However, this should not be a cause for concern. You have probably already used most of the operators that Java provides. This module will review these operators and point out any important aspects of them that you should
master in preparation for the exam.
This module will review your knowledge of Java operators, provide numerous examples of their use, and help you to satisfy the following exam objectives:
- Determine the result of applying any operator, including assignment operators and
instanceof to operands of any type, class, scope, accessibility, or any combination of these.
- Determine the result of applying the boolean
equals(Object) method to objects of any combination of the classes
- In an expression involving the operators
and variables of known values, state which operands are evaluated and the value of the expression.
In addition to the above, you will cover the topics of conversion, casting, operator precedence, and order of evaluation.
Building expressions using operands and operators
An expression consists of operands and operators. Operands are normally variable names or literals while operators act on operands. The following are examples of expressions:
int numberWheels = 4;
numberWheels = numberWheels + 1;
There are several ways of classifying operators:
- Logical complement
Expressions can be thought of as the building blocks of a program and are used to express the logic of the program