Advertisements
Advertisements
Question
Evaluate the following expression as per Java priority & associativity.
24 % (3*2)
Evaluate
Advertisements
Solution
Priority (Precedence): Parentheses () have the highest precedence, so the expression inside them is evaluated first.
- (3 * 2): Evaluates first, giving 6. The expression simplifies to 24 % 6.
- 24 % 6: Performs the modulo operation. Since 24 is exactly divisible by 6 (6 × 4 = 24), the remainder is 0.
shaalaa.com
Is there an error in this question or solution?
Chapter 1: Revision of Class 9 Syllabus - Exercises [Page 45]
