|
(Review: ) Is the following a correct expression? 13 * 6 - A good answer might be:No. |
Expressions
The literals (the integers) and the operators are out of order in the
above incorrect expression.
(One legal arrangement is An expression is a combination of literals, operators, variables, and parentheses used to calculate a value. Of course, the parts of an expression must be arranged correctly. The syntax of Java (or any programming language) describes the correct arrangements. The details of this will be left to another course (or your on-line documentation, if you care to dig through it.) The rules for correct Java expressions are about the same as for algebra. We need to talk about operators and operands. You already know what an operator is (a symbol +, -, *, / that calls for an arithmetic operation.) An operand is a value that is acted upon by an operator.
For example, in |
QUESTION 2:Are arithmetic expressions the only kind of expression? Click Here after you have answered the question |