执行下面的程序后,打印5条Hello Java行。所以我知道i ++有打印10行。我需要在此程序中执行i + = 2的职责。
class Example{
public static void main(String args[]){
for(int i=0; i<10; i+=2){
System.out.println("Hello Java");
}
}
}
for(int i = 0; // i is an variable integer, which is 0 from the start
i < 10; // if i is 10 or above, the loop is finished, else the code runs
i += 2) // after the code is ran, 2 will be added to the variable i
{/*...*/}