These two loops are not the same:
- The first loop will never stop
- The second loop will run for a long time, until
i
overflows, at which point the loop will exit.
Given that these two loops are not the same, the byte code, CPU usage, and speed for each would be different as well.
1
solved In Java, is a while(true) behaving equally as an endless for-loop?