Java线程- main方法的优先级

package com.mldn;

 

public class PriorityIntValue

{

public static void main(String[] args)

{

System.out.println(“main方法的优先级是:” + Thread.currentThread().getPriority()); // 获取主方法的优先级

 

System.out.println(“Thread.MAX_PRIORITY = ” + Thread.MAX_PRIORITY); // 获取优先级的int值

System.out.println(“Thread.NORM_PRIORITY = ” + Thread.NORM_PRIORITY);

System.out.println(“Thread.MIN_PRIORITY = ” + Thread.MIN_PRIORITY);

}

}

/*

administrator@xu-desktop:~$ javac -d . ./work/PriorityIntValue.java

administrator@xu-desktop:~$ java com.mldn.PriorityIntValue

main方法的优先级是:5

Thread.MAX_PRIORITY = 10

Thread.NORM_PRIORITY = 5

Thread.MIN_PRIORITY = 1

可以看出mian方法是采用普通优先级运行的!

 

*/

 

声明: 除非转自他站(如有侵权,请联系处理)外,本文采用 BY-NC-SA 协议进行授权 | 嗅谱网
转载请注明:转自《Java线程- main方法的优先级
本文地址:http://www.xiupu.net/archives-71.html
关注公众号:嗅谱网

赞赏

wechat pay微信赞赏alipay pay支付宝赞赏

上一篇
下一篇

相关文章

在线留言

你必须 登录后 才能留言!