/** * スレッド生成の例示用クラス * StartThreadクラスのスレッドを3つ生成し実行する */ class ThreadCreation { public static void main (String[] args) { Thread thread[] = new Thread[3]; /* スレッドを生成する */ thread[0] = new StartThread (0, 5000L); /* 5秒停止するスレッド */ thread[1] = new StartThread (1, 7000L); /* 7秒停止するスレッド */ thread[2] = new StartThread (2, 4000L); /* 4秒停止するスレッド */ /* スレッドの実行開始 */ for (Thread th : thread) { th.start(); } } }