/* Threads with different priorities */

public class Test5 {

  static final int NUM_THREADS = 10;
  static MyThread5 myThreads[];

  public static void main(String[] argv){
    myThreads = new MyThread5[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 MyThread5 createThread(int i){
    return new MyThread5(new Integer(i).toString(), i+1);
  }
}

class MyThread5 extends Thread{

  static final int NUM_PRINTS = 30;

  MyThread5(String s){
    super(s);
  }

  MyThread5(String s, int priority){
    super(s);
    setPriority(priority);
  }

  public void run(){
    for (int i=0; i < NUM_PRINTS; i++){
      System.out.print(getName());
    }
  }
}









