Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String[] args) {
        // Create a Thread object
        Thread t = new Thread(Main::print);

        // Start the thread 
        t.start();
    }

    public static void print() {
        for (int i = 1; i <= 5; i++) {
            System.out.print(i + "  ");
        }
    }
}