Software_guy
Owee<br />SCJP 1.4
Software_guy
Postfix increment operator (i++) uses the current value of i as the value of the expression first, then adds 1 to i.
Owee<br />SCJP 1.4
int i = 1;
i= i++;
int b = i; //Line 2
System.out.println(b);
will I get the value of b as 2( since we r using a post increment operator)?
Owee<br />SCJP 1.4
Thanks,
Shekar
How simple does it have to be???
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
How simple does it have to be???
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
Sean Walker<br />PMP, SCEA, SCWCD, SCJP
How simple does it have to be???
Originally posted by abdullasm mamuwala:
Although the problem has been explained quite beautifully.
But the concept simply is,
The ASSIGNMENT operator has precedence over the POSTFIX increment operator
Correct me if I am wrong.
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
|