*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes the ++ operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "the ++ operator" Watch "the ++ operator" New topic
Author

the ++ operator

Vishwanath Krishnamurthi
Ranch Hand

Joined: Jun 04, 2007
Posts: 331
Hi,

Considering the code,



I don't understand why the O/P of the code is 0 and not 1... I thought
lineA would reduce to i=0 and just after that assignment is done i value would be incremented, so that println() would see a println(1) but it doesnt seem to be so...

Can you please help me understand this?


Blog
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

See JavaRanch FAQ: Post Increment Operator And Assignment.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
 
subject: the ++ operator
 
Similar Threads
Thread question
about GC
french amimated cartoon called the line (la ligne)
Thread and Heap Memory
What' s wrong with this code?