This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General 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