I have program where there's text that's being printed. I want to know how I can make it so that the text wait's with printing until I press enter. Thanks in advance.
At the top of the program, create a Scanner
with System.in
as its source:
Scanner scan = new Scanner(System.in);
Whenever you want to pause:
System.out.println("Press ENTER to continue..."); // optional
scan.nextLine();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.