Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**
     * Starts the given {@link Runnable} tasks as daemons
     * 
     * @param tasks
     */
    public static void startDaemon(Runnable... tasks) {
        for (Runnable task : tasks) {
            Thread thread = new Thread(task);
            thread.setDaemon(true);
            thread.setPriority(Thread.NORM_PRIORITY);
            thread.start();
        }
    }

    /**
     * Starts the given {@link Runnable} tasks as normal threads
     * @param tasks
     */
    public static void start(Runnable... tasks) {
        for (Runnable task : tasks) {
            new Thread(task).start();
        }
    }
}