📄 testthreadpriority.java
字号:
public class testThreadPriority{
public static void main(String arg[]){
myThread A=new myThread("A",3);
myThread B=new myThread("B",9);
myThread C=new myThread("C",5);
A.start();
B.start();
C.start();
try{
A.join();
B.join();
C.join();
}catch(InterruptedException e){}
}
}
class myThread extends Thread{
String Name;
int Priority;
myThread(String Name,int Priority){
this.Name=Name;
this.Priority=Priority;
this.setPriority(Priority);
}
public void run(){
System.out.println("线程"+Name+"启动,优先级数是:"+Priority);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -