user3347814
user3347814

Reputation: 1133

Java: For loop: can not be resolved to a variable error

When I try to compile this code, I get an error saying:

i cannot be resolved to a variable

What I´m doing wrong? How can I fix it?

boolean[] onibusDoTrajeto(int trajeto1, int trajeto2){

  boolean[] lugaresNoTrajeto = new boolean[49];

    for(int j = 0; j < _assentos[0].length; j++) {
      for (i = trajeto1; i <= trajeto2; i++){

        if (_assentos[i][j] = true){
         lugaresNoTrajeto[j] = true;
         break;
        }
      }
    }
}

Upvotes: 1

Views: 145

Answers (1)

Karan
Karan

Reputation: 284

You're missing "int" before your i.

Upvotes: 7

Related Questions