OperatorPriority
This program excerpt helps the user to get acquainted
with operators' priority.
Download files: OperatorPriority.java
Areas: Primitive types.
Download files: OperatorPriority.java
Areas: Primitive types.
|
|
OperatorPriority.java |
|
View full source |
| Question 1 |
| In the arithmetic expression, 8 + 3 * -17 % 5, which of the operators are unary? Which of them are binary? |
| Question 2 |
| Which operators, unary or binary, have higher precedence? |
| Question 3 |
| Between the operator + and the operator *, which has a higher precedence? |
| Question 4 |
| What does the operator % do? How does the precedence of % compare with that of * ? |
| Question 5 |
| What is the value of result after the first assignment? |
| Question 6 |
| What is the value of result after the second expression? |
| Question 7 |
| What is the result of the third expression? |
| Question 8 |
| How can we make the precedence of operators in an expression clearer? |
