This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes post increment operator question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "post increment operator question" Watch "post increment operator question" New topic
Author

post increment operator question

Durgaprasad Guduguntla
Ranch Hand

Joined: Oct 20, 2003
Posts: 99
Please look at the the following code:

The answer is 1 2 1. The first part is clear i.e., i value is printed before incrementing and then incremented value is stored in i and this value is printed in second print statement. The second part is not clear for me. I thought j value would be 2 as the print statement given after incrementing. Can someone explain how does the value of j becomes 1?


Thanks,<br />Durgaprasad<br />SCJP1.4, SCWCD1.4, SCBCD1.3,<br />SCEA
Cathy Song
Ranch Hand

Joined: Aug 24, 2003
Posts: 270
Hi,
This thread should be helpful..
http://www.coderanch.com/t/243292/java-programmer-SCJP/certification/Infinite-loop-WHY
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: post increment operator question
 
Similar Threads
post increment confusion
Interface Q
Help with FOR
K&B Book for Scjp 6 - Chapter 5 question 8 doubt
prefix v postfix increment : ++ X v X ++