Sleep in java by Option 1: Thread.sleep(4000); Option 2: import java.util.concurrent.TimeUnit TimeUnit.SECONDS.sleep(2);