为什么下面代码的输出是Thread [main,5,main] [英] Why the out put of below code is Thread[main,5,main]
本文介绍了为什么下面代码的输出是Thread [main,5,main]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public class test1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Thread t = Thread.currentThread();
System.out.println(t);
}
}
为什么上面代码的输出是 - Thread [main ,5,主要]?
请解释
Why the output of above code is - Thread[main,5,main] ? Please Explain
推荐答案
因为 thread.toString()
返回此线程的字符串表示形式,包括线程的名称,优先级和线程组。
Because thread.toString()
returns a string representation of this thread, including the thread's name, priority, and thread group.
这篇关于为什么下面代码的输出是Thread [main,5,main]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文