Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple Doubt

 
Mahesh Subramaniya
Greenhorn
Posts: 19
Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why is the output of "i" of the following snippet is 0 and not 1

int i = 0;
i = i++

Does the expression gets evaluvated from left to right?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question comes often
It's in the FAQ:
http://faq.javaranch.com/view?PostIncrementOperatorAndAssignment
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic