主线程优先级的值是多少? [英] what is the value for main thread priority?

查看:114
本文介绍了主线程优先级的值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有线程都有自己的优先级,那么主线程的整数值是多少?

all threads have its priority,so what is the integer value for main thread?

推荐答案

此代码显示优先级主线程:

This code shows you the priority of the main thread:

public class Main {
    public static void main( String [] args ) {
        System.out.println( Thread.currentThread().getPriority() );
    }
}

输出和问题的答案是 5

这篇关于主线程优先级的值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆