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