[Solved] Java about Array of object


if doesn’t cause the condition to be evaluated in a loop. You need to use a loop for that.

while (x<3) { 
   //changes made to to mydogs[x] are irrelevant to the execution of the loop
   x = x+1;
}

This loop will run continually until the condition x < 3 evaluates to false, which will only happen after x = x+1 has been executed 3 times. until then, the code inside the loop body will be repeatedly executed.

solved Java about Array of object