What is ThreadGroup in java, What is default priority of newly created threadGroup, mention some important ThreadGroup methods ?
Java Interview Questions and Answers (part 4)
(Continued from previous question...)
59. What is ThreadGroup in java, What is default priority of newly created threadGroup, mention some important ThreadGroup methods ?
When program starts JVM creates a ThreadGroup named main. Unless specified, all newly created threads become members of the main thread group.
ThreadGroup is initialized with default priority of 10.
ThreadGroup important methods :
. getName()
name of ThreadGroup.
. activeGroupCount()
count of active groups in ThreadGroup.
. activeCount()
count of active threads in ThreadGroup.
. list()
list() method has prints ThreadGroups information
.getMaxPriority()
Method returns the maximum priority of ThreadGroup.
. setMaxPriority(int pri)
Sets the maximum priority of ThreadGroup.
(Continued on next question...)
Other Interview Questions
|