[Solved] Java: I can’t get it to loop, somethings wrong with the boolean but I don’t know how to fix it


Your break is the culprit…

When you use break it breaks out of the loop.

So use, (Note: You don’t need an else if, just else should be sufficient).

        if(answer.equals("y")){
            yn = true;
        } else {
            yn = false;
        }

without break statement.

Also use a condition (not assignment) inside while,

while(yn == true)

or simply,

while(yn)

3

solved Java: I can’t get it to loop, somethings wrong with the boolean but I don’t know how to fix it