A good answer might be:No. For example, the following is also an expression: "This is" + " a string" + " expression" | ||||||||||||||||||||||||
Arithmetic OperatorsBut arithmetic expressions are especially important. As you have seen, Java has many operators for arithmetic:
All of these operators can be used on floating point numbers and on integer numbers. (However, the % operator is rarely used on floating point.) For instance, / means "integer division" if both operands are integers, and means "floating point division" if one or both operands are floating point.
An integer operation is always done with 32 bits or more.
If one or both operand is 64 bits (data type
With (for example) 16 bit short x = 12; // 16 bit short int result; // 32 bit int result = x / 3; // arithmetic will be done using 32 bits
For the expression short x = 12; short y = 3; short result; result = x / y;
For the expression
At the professional programming level, details like these are sometimes important.
(To understand them in full you need a course like "Assembly Language"
or "Digital Systems.")
But mostly for general purpose programs you should use | ||||||||||||||||||||||||
QUESTION 3:
Do you expect that a modern electronic calculator will give you the same
answer as Java for the expression
|