How to pause my Java program for 2 seconds

You can use: or Please note that both of these methods throw InterruptedException, which is a checked Exception, So you will have to catch that or declare in the method. Edit: After Catching the exception, your code will look like this: Since you are new, I would recommend learning how to do exception handling once you … Read more