/* This is my eight threaded program in Java */ public class Test8 { public static void main(String args[]){ MainThread starter = new MainThread(); starter.start(); } } class MainThread extends Thread{ static final int NUM_THREADS = 10; static MyThread8 myThreads[]; public void run(){ currentThread().setPriority(MAX_PRIORITY); myThreads = new MyThread8[NUM_THREADS]; for (int i=0; i < NUM_THREADS; i++) myThreads[i] = createThread(i); for (int i=0; i < NUM_THREADS; i++) myThreads[i].start(); try { for (int i=0; i < NUM_THREADS; i++) myThreads[i].join(); } catch (InterruptedException e){ return; } System.out.println(); } public static MyThread8 createThread(int i){ return new MyThread8(new Integer(i).toString(), i+1); } } class MyThread8 extends Thread{ static final int NUM_PRINTS = 30; MyThread8(String s){ super(s); } MyThread8(String s, int priority){ super(s); setPriority(priority); } public void run(){ for (int i=0; i < NUM_PRINTS; i++){ System.out.print(getName()); } } }