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