I have the following code, although I want it in the function to run after 5 seconds of the System.out.println statement For example
System.out.println ("done well"); // *** 5 seconds delay *** system.exit (0); `
How do I go about making a 5 second delay between that printlane and exit?
system. Out.printLN ("done well"); Thread.Sleep (5000); System.exit (0); `
Or to be a bit more specific, you can use this method:
System.out.println (" Awesome ") ; TimeUnit.SECONDS.sleep (5); System.exit (0); On another note, this information is trivial to search through Google. The search term "Java Pauses" or "Java Sleep" puts many links relevant to your query.
No comments:
Post a Comment