Java for Loop evaluation

前端 未结 9 2299
孤独总比滥情好
孤独总比滥情好 2020-12-03 21:45

I want to know if the condition evaluation is executed in for and while loops in Java every time the loop cycle finishes.

Example:

9条回答
  •  执笔经年
    2020-12-03 22:29

    Do you ask wether the compiler caches the tenBig.length value since he knows it won't change during the loop? Or you ask wether the compiler automatically knows that the whole expression index < tenBig.length does not need to be evaluated for the next 9 times?

提交回复
热议问题