java - What is the difference between a += b and a =+ b , also a++ and ++a? -
as mentioned in title,
what difference between += b , =+ b , a++ , ++a ? i'm little confused
a += b
equivalent a = + b
a = +b
equivalent a = b
a++
, ++a
both increment a
1. difference a++
returns value of a
before increment whereas ++a
returns value after increment.
that is:
a = 10; b = ++a; //a = 11, b = 11 = 10; b = a++; //a = 11, b = 10
Comments
Post a Comment