java - Set a delay on System.exit(0) -
i have code below, want in function run 5 seconds after system.out.println statement examples
system.out.println("well done"); //***5 second delay*** system.exit(0);`
how go creating 5 second delay between println , exit?
system.out.println("well done"); thread.sleep(5000); system.exit(0);`
or little more specific, can use timeunit#sleep
method on timeunit.seconds
:
system.out.println("well done"); timeunit.seconds.sleep(5); system.exit(0);`
on note, information trivial find through google. search term "java pause" or "java sleep" throws number of links relevant question.
Comments
Post a Comment