English

Distinguish between Postfix increment and Prefix increment. - Computer Applications

Advertisements
Advertisements

Question

Distinguish between Postfix increment and Prefix increment.

Distinguish Between

Solution

S. No. Postfix increment Prefix increment
1. This operator operates on the idea of 'CHANGE BEFORE ACTION'. This operator operates on the basis of 'CHANGE AFTER ACTION'.
2. Example: 
d = 10;
t = 5 * (++d) // t = 5 * 11 = 55 
Example: 
d = 10; 
t = 5 * (d++) // t = 5 * 10 = 50
shaalaa.com
  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. 4. (b) | Page 44
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×