+ 3
In array, what happen after for statement we put semicolon? It is does not excute anything or it just ignore the for statement?
For example System.out.print("Three cheer for Ironman!") for (int i=0 ; i <4 ; i++); System.out.println("HIP HIP,HORAY!");
2 odpowiedzi
+ 1
The semicolon ensures that the code that comes after that does not belong to the loop. So the loop does only what is inside the header, in your case i++ until i = 4.
Edit:
for(int i = 0;i<=4;System.out.println(i++));
//prints the numbers from 0 to 4