Knowledge Walls
John Peter
Pune, Maharashtra, India
How to use delay in Java Program with Example
2906 Views
DelayInJavaWithThreadSleepMethod
public class DelayInJavaWithThreadSleepMethod {
    public static void main(String args[]) throws InterruptedException{
        System.out.println("10 Seconds Counter");
        System.out.println("Start");
        
        for (int i=1;i<=10;i++){
            Thread.sleep(1000);
            System.out.println(i);
        }
        
        System.out.println("End");
    }
}
Output 
10 Seconds Counter
Start
1
2
3
4
5
6
7
8
9
10
End
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details