在Java中打印线程实例的意义是什么? [英] What's the meaning of printing a thread instance in Java?
本文介绍了在Java中打印线程实例的意义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,
System.out.println( Thread.currentThread() );
给予
Thread[main,5,main]
[main,5,main]是什么参考?我猜也许其中一个是名字,但我想知道这一切究竟是什么意思。
What does [main,5,main] refer to? I am guessing perhaps one of them is the name, but I want to know what it all means precisely.
推荐答案
来自javadoc 线程:
From the javadoc of Thread:
public String toString()
返回此线程的字符串表示形式,包括线程的名称,优先级和线程组。
Returns a string representation of this thread, including the thread's name, priority, and thread group.
这篇关于在Java中打印线程实例的意义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文