[Solved] For loop not executed


I’m not sure what you are going for exactly but this is your problem in your loop

t == 5

it should be something like

for(int t = 1; t <= 5; t = t+1) {

t is never 5 here so it will never iterate. Also, you can simplify the last part so it looks like

for(int t = 1; t <= 5; t++) {

If you look at the Java docs for a for loop

for (initialization; termination;
increment) {
statement(s)
}

Now look what it says for the termination expression

When the termination expression evaluates to false, the loop terminates.

The termination expression is false from the beginning meaning it won’t run.

solved For loop not executed