Computer Science, asked by manijeevi79, 5 months ago

Tabulate the precedence of
operators with its description and
priority.​

Answers

Answered by pranavhjd
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