Wednesday 15 February 2012

java - Why is a still 0 after that operation? -



java - Why is a still 0 after that operation? -

this question has reply here:

java: pre-,postfix operator precedences 4 answers

why a still 0 after next operation?

int = 0; a+=a++;

a++ increments a returns previous value 0.

that's why a+=a++, equivalent a=a+a++, sets a 0+0;

java

No comments:

Post a Comment