标签:let break ide main com ati over complete read
/**
* 优先级
*/
public class PriorityDemo {
public static class HightPriority extends Thread{
static int count = 0;
@Override
public void run() {
while (true){
synchronized (PriorityDemo.class){
count++;
if (count>100000000){
System.out.println("HightPriority is complete");
break;
}
}
}
}
}
public static class LowPriority extends Thread{
static int count = 0;
@Override
public void run() {
while (true){
synchronized (PriorityDemo.class){
count++;
if (count>100000000){
System.out.println("LowPriority is complete");
break;
}
}
}
}
}
public static void main(String[] args){
HightPriority hightPriority = new HightPriority();
LowPriority lowPriority = new LowPriority();
hightPriority.setPriority(Thread.MAX_PRIORITY);//高优先级
lowPriority.setPriority(Thread.MIN_PRIORITY);//低优先级
lowPriority.start();
hightPriority.start();
}
//HightPriority is complete
//LowPriority is complete
}
标签:let break ide main com ati over complete read
原文地址:https://www.cnblogs.com/fly-book/p/11383759.html