Skip to content
Sharp

Core Java · interview question

What will be the result of the following expression: 'int result = 20 / 4 + 3 * 2 - 1;'?

Multiple choiceHardchapter-1-curatedpremiumcore-javaoperators-and-expressions
Choose one answer
Answer and explanation

Correct answer

B. 12

Why

The division '20 / 4' is evaluated first, resulting in 5. Then '3 * 2' is evaluated, resulting in 6. The expression becomes '5 + 6 - 1', which evaluates to 10.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →