This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

the ++ operator  RSS feed

 
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
Boost this thread!