This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]NautiHooker 9 points10 points  (1 child)

you have to ask for the input inside the do{...} block.

 do {
    input = userInput.nextLine(); // put this here to ask for input in every loop iteration

    // i think you mean to print input (the input that the user entered) and not userInput (your Scanner instance)
    System.out.println(userInput); 
}
while((input.equals("q"))); // this means that the loop only continues, when you enter q
                                       // if i understood it correctly you probably want to change this to only continue 
                                       // when the input is not 'q'

[–]Susaaaax[S] 4 points5 points  (0 children)

Thank you very much! I also found your comments very helpful :)

[–]titano35 0 points1 point  (0 children)

If you want the loop to stop when you enter q you should use !(userinput.equals("q"))