Srikar
0
Q:

site:javaexample.org

package com.beginner.examples;

import java.util.Date;

public class DelayRun {

  public static void main(String[] args) {

    System.out.println("It is : " + new Date());
    try {
      Thread.sleep(4000); // delay few seconds
      System.out.println("It is : " + new Date());
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
  }
}
Copy
1

New to Communities?

Join the community