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.
Just run it and could you please let me know if there is any supporting doc from sun or somewhere else, where it says why the code doesn’t work.
No need to overcome the problem. Since we can get the expected result by twisting the code a bit or simply by using different variable or by using pre-incremental operation i.e. ++count1/++count2 .
My requirement is to know why does this happen in case of below particular situation?
Please refer the below code:
Output: I tested in java 5 and found that variable count2 does not get incremented.
Agree. Since you are new, I shall add the tags and you can see how much better it looks.
You are so nice! And further, I let him to search and find the appropriate answer. But, you gave the exact answer~!
Joined: Oct 13, 2005
Abimaran Kugathasan wrote: . . . I let him to search and find the appropriate answer. But, you gave the exact answer~!
You're welcome. The post increment and post decrement operators cause no end of confusion, and they are very difficult to search for on JavaRanch because you can't search for ++ or --. So it is much easier if I know where there are old threads about this problem.