Pre and post increment in a for loop [duplicate]
问题 This question already has answers here : Is ++i really faster than i++ in for-loops in java? (11 answers) Closed 6 years ago . Is it more performant to do a pre-increment vs a post-increment in a for loop in java ? Sample code : for (int i=0; i<10; i++) and for (int i=0; i<10; ++i) I notice that when i do a pre-increment, the execution time is lesser that when i do the post-increment. Any suggestions on why this might be the case ? thanks. 回答1: I compiled a minimal example (Oracle jdk1.7.0_07