16.3k views
2 votes
What is the output of intb= 4+ 6 /2 Systemoutprintln (b)

User Nimer
by
6.8k points

1 Answer

5 votes

Answer:

Command: Systemoutprintln (b)

Output: 7

Step-by-step explanation:

To solve this problem, we must take into account the precedence of operation.

The division takes precedence before the addition, so we must divide before we add for b.

So

int b = 4 + 6/2 = 4 + 3 = 7.

So

Command: Systemoutprintln (b)

Output: 7

User Zardosht
by
6.9k points