+ 1
for(;;) { int i=0; if(i==1){System.out.println(i); break;} ++i;} Will this code run for infinite times? If yes then how?
This is regarding for loop. I want to know how iteration occurs in this case
1 Respuesta
0
it will run infine amount of times cause in the loop you declare 'i' and assifn 0 to it. later you check if it is equal 1 but it is not. next you say "i want i to be 1 now". and then you go back and override 'i with a number of 0