Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;

public class Main {
    private static List<WeakReference<Thread>> threadlist = new ArrayList<>();

    public synchronized static Thread CreateThread(Runnable run) {
        Thread thread = new Thread(run);
        threadlist.add(new WeakReference<>(thread));
        return thread;
    }
}