Difference in implementation of x = x + 1 and x++
问题 My professor recently said that although x = x + 1 and x++ will obviously give the same result, there is a difference in how they are implemented in the JVM. What does it mean? Isn't compiler like: hey, I see x++ so I will switch it to x = x + 1 and carry on? I doubt there is any difference when it comes to efficiency, but I would be surprised if assembly would be different in those cases... 回答1: My professor recently said that although x = x + 1 and x++ will obviously give the same result I