for (int i = 0; i < 3; ++i){}
时间: 2024-05-24 11:10:31 浏览: 134
java中for(int i= 0; i<=10;i=i++)System.out.print(i);为什么无限输出0
This for loop is missing the third expression that specifies the increment/decrement of the loop variable. It should be:
for (int i = 0; i < 3; i++) {}
This loop will execute the code block inside the curly braces 3 times, with the loop variable i starting from 0 and incrementing by 1 each time until it reaches 2 (because the condition i < 3 will no longer be true when i is 3).
阅读全文