Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.concurrent.TimeUnit;

public class Main {
    public static void main(String[] args) {
        try {
            System.out.println("sleep for 5  seconds.");
            TimeUnit.SECONDS.sleep(5); // Same as  Thread.sleep(5000);
            // The "main" thread will sleep
            System.out.println("woke up.");
        } catch (InterruptedException e) {
            System.out.println("interrupted.");
        }
        System.out.println("done.");
    }
}