class A extends Thread {
public void run() {
for (int i = 1; i < 5; i++) {
System.out.println("Thread A Loop NO " + i);
}
System.out.println("Exit from A");
}
}
class B extends Thread {
public void run() {
for (int j = 1; j < 5; j++) {
System.out.println("Thread B Loop no. " + j);
}
System.out.println("Exit from B");
}
}
class C extends Thread {
public void run() {
for (int k = 1; k < 5; k++) {
System.out.println("Thread C Loop no " + k);
}
System.out.println("Exit Form c");
}
}
class Demo1 {
public static void main(String args[]) {
A a1 = new A();
B b1 = new B();
C c1 = new C();
c1.setPriority(Thread.MAX_PRIORITY);
a1.start();
b1.start();
c1.start();
}
}
我多次运行这个程序。有时具有最大优先级的线程“C”最后完成最大优先级是否不能确保它首先终止?我的意思是在任何其他线程退出循环之前?如果不是,调度程序策略是什么?