/* * Illustrates thread priority */ package threads; public class TaskTwo implements Runnable{ private String message; public TaskTwo(String message) { this.message = message; } public void run() { int i=0; while(++i<=100) System.out.println(message + " " + i); } public static void main(String[] args) { TaskTwo t = new TaskTwo("First"); Thread threadOne = new Thread(t); threadOne.setPriority(Thread.MIN_PRIORITY); threadOne.start(); t = new TaskTwo("Second"); new Thread(t).start(); System.out.println("main thread done"); } }