File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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
 
 
subject: using a++ and a+1 ?