English

What is the value of y after evaluating the expression given below? y+= ++y + y-- + --y; when int y=8; - Computer Applications

Advertisements
Advertisements

Question

What is the value of y after evaluating the expression given below?

y+= ++y + y-- + --y; when int y=8; 

Answer in Brief

Solution

33

Working:

y+= ++y + y-- + --y;

y = y + (++y + y-- + --y)

= 8 + (9 + 9 +7)

= 8 + 25

= 33

shaalaa.com
Introduction of Values and Data Types
  Is there an error in this question or solution?
Chapter 1.04: Operators in Java - EXERCISES [Page 44]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.04 Operators in Java
EXERCISES | Q V. 6. (d) | Page 44
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×