class DownCounter implements Runnable {
public void run() {
for (int i = 10; i >= 1; i--) {
System.out.println("Counting Down: " + i);
}
}
}
public class MainClass {
public static void main(String[] argv) {
DownCounter dc = new DownCounter();
Thread t = new Thread(dc);
t.start();
int oldPriority = t.getPriority();
int newPriority = Math.min(oldPriority + 1, Thread.MAX_PRIORITY);
t.setPriority(newPriority);
}
}
|