This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Simple Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple Doubt" Watch "Simple Doubt" New topic
Author

Simple Doubt

Mahesh Subramaniya
Greenhorn

Joined: Dec 12, 2004
Posts: 19

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?


Mahesh Subramaniya

OCMJEA/SCEA
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

This question comes often
It's in the FAQ:
http://faq.javaranch.com/view?PostIncrementOperatorAndAssignment


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple Doubt
 
It's not a secret anymore!