• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

the ++ operator

 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Considering the code,



I don't understand why the O/P of the code is 0 and not 1... I thought
lineA would reduce to i=0 and just after that assignment is done i value would be incremented, so that println() would see a println(1) but it doesnt seem to be so...

Can you please help me understand this?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See JavaRanch FAQ: Post Increment Operator And Assignment.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic