Tabulate the precedence of
operators with its description and
priority.
Answers
Answered by
0
Now, take a look at the statement below:
int myInt = 12 - 4 * 2;
What will be the value of myInt? Will it be (12 - 4)*2, that is, 16? Or it will be 12 - (4 * 2), that is, 4?
When two operators share a common operand, 4 in this case, the operator with the highest precedence is operated first.
In Java, the precedence of * is higher than that of -. Hence, the multiplication is performed before subtraction, and the value of myInt will be 4.
Similar questions
Computer Science,
2 months ago
Math,
2 months ago
Social Sciences,
2 months ago
Computer Science,
5 months ago
India Languages,
5 months ago
Science,
11 months ago
Science,
11 months ago
Hindi,
11 months ago