Am I using the wrong loop or the loop wrong

I'm using java 17 and here's my loop
the 'for' is there to print out the 'i' question

then i want the 'while' loop to let you
type out guesses until you get the correct answer
and once you are correct it adds '1' to 'i'
so that it prints out the next question


as of now what i have before this code is just the q & a string and the scanner

and when I run it
it prints the first question
and every input after does nothing correct answer or not


for (int i = 0; i < questions.length;) {
System.out.println(questions[i]);

while (true) {
if (scanner.equals(answers[i]))
System.out.println("You are correct");
i =+ 1;
}
Was this page helpful?