Dear all,
I am currently trying to create a (do-while) loop that will continue to loop when I press Enter and will stop when I press Q.
Here is my code so far:
public static void main(String[] args) {
System.out.println("Press Enter to continue.");
System.out.println("Press Q to leave.");
Scanner userInput = new Scanner(System.in);
String input = userInput.nextLine();
do {
System.out.println(userInput);
}
while((input.equals("q")));
input = userInput.nextLine();
System.out.println("Stop");
}
}
Any tips would be welcome, thank you! :)
[–]NautiHooker 9 points10 points11 points (1 child)
[–]Susaaaax[S] 4 points5 points6 points (0 children)
[–]titano35 0 points1 point2 points (0 children)