This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes using a++   and  a+1 ? 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 » Java » Beginning Java
Bookmark "using a++   and  a+1 ?" Watch "using a++   and  a+1 ?" New topic
Author

using a++ and a+1 ?

Anto Telvin
Ranch Hand

Joined: Aug 12, 2008
Posts: 113
hi all
why it is saying that a++ is faster than a+1 ?



thanks in advance


Anto Telvin Mathew<br />Many of the life failures are people who did not realize how close they were to success when they give up. EDISON
Bupjae Lee
Ranch Hand

Joined: May 14, 2007
Posts: 107
SUN JDK javac 1.6.0_07 compiler generates bytecodes like below:



It is true that a++ is slightly faster than a=a+1, but I think there are not that much difference.
Anto Telvin
Ranch Hand

Joined: Aug 12, 2008
Posts: 113
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using a++ and a+1 ?
 
Similar Threads
Portal and portlet developement forum
count yourself in javaranch#~
How many rotations...
0 or 1
Are there any Parsi guys on JR?