How to make a delay in JAVA ??

Submitted 3 years, 4 months ago
Ticket #312
Views 254
Language/Framework Java
Priority Low
Status Closed

I am looking for a while loop solution ...

Submitted on Nov 30, 20
add a comment

1 Answer

Verified

You can try this way 

​
public class loops {
    public static void main(String args[]) throws InterruptedException {
        int countdown = 1;
        while (countdown < 10){
            System.out.println(countdown);
            ++countdown;
            Thread.sleep(1000);
        }
    }
} 
​

Submitted 3 years, 4 months ago


Latest Blogs