Multiple choice

If result = 2 + 3 * 5, what is the value and type of 'result' variable?

  1. 17, byte

  2. 25, byte

  3. 17, int

  4. 25, int

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Java follows standard mathematical precedence: multiplication before addition. So 2 + 3 * 5 = 2 + (3 * 5) = 2 + 15 = 17. Since all operands are integers, the result is also an integer (int), not a byte. The '17, int' option correctly captures both the calculated value and the data type.