Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Increment Operator

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

The code below...



Regards,
Jothi Shankar Kumar. S
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jothi Shankar Kumar Sankararaj:
Hi all,

The code below...



Regards,
Jothi Shankar Kumar. S


Dear Jothi,

This question is asked so many times in this forum, It would be great if you search in the forum for earlier thread.

Or you may even check out this one.
1. Increment operation question

2. Post Increment

Hope you find it usefull.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sharma,

Thanks for the feedback. Im checking it.

Regards,
Jothi Shankar Kumar. S
 
Prafulla N. Patil
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if it was as
i=++i;

then it will print as 2

try to underatand diff between ++i and i++ (PreIncrement and PostIncrement)

in your case assignment is done first and then increment is done !!!1
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic