1

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;
        }
      }
    }
}

1 Answer 1

7

You're missing "int" before your i.

Sign up to request clarification or add additional context in comments.

3 Comments

=/ I´m so sorry for wasting your time!
Not at all! Happens to everyone (:
@Karan Yes, I did; the question is on its way to getting closed as a typographical error. I meant to suggest that OP delete, but Hovercraft is right, it's got an upvoted answer, so it can't be deleted. I should read more carefully all around.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.