Java ThreadGroup toString() method11 Nov 2024 | 1 min read The toString() method of ThreadGroup class returns a string representation of the Thread group. SyntaxReturnIt returns the string representation of the thread group. ExampleOutput: Thread-1 starts Thread-2 starts String equivalent: java.lang.ThreadGroup[name=parent thread group,maxpri=10] String equivalent: java.lang.ThreadGroup[name=child threadGroup,maxpri=10] Thread-1 completed executing Thread-2 completed executing Next TopicJava-threadlocalrandom |
The isDestroyed() method of ThreadGroup class tests if the thread group has been destroyed. Syntax: public boolean isDestroyed() Return: This method returns true if the object is destroyed. Example class NewThread extends Thread { NewThread(String threadname, ThreadGroup tg) { ...
2 min read
The getParent() method of ThreadGroup class returns the parent of the thread group. Syntax: public final ThreadGroup getParent() Return: This method returns the parent of the thread group. Exception: SecurityException: If the current thread cannot modify the thread group. Example class NewThread extends Thread { NewThread(String threadname, ThreadGroup tg) ...
2 min read
The isDaemon() method of ThreadGroup class tests if this thread group is a daemon thread group. Syntax public final boolean isDaemon() Return This method returns true if this thread group is a daemon thread group. Otherwise, it will return false. Example class NewThread extends Thread { NewThread(String threadname,...
2 min read
The activeCount() method of ThreadGroup class determines if the currently running thread has permission to modify the thread group. Syntax public final void checkAccess() Return It doesn't return any value. Exception SecurityException: This exception throws if the current thread is not allowed to access the thread group. Example class NewThread extends Thread { ...
2 min read
The list() method of ThreadGroup class is used to display the information about the thread group. It is useful only for debugging. Syntax public void list() Return This method does not return any value. Example class List extends Thread { List(String threadname, ThreadGroup tgob) { ...
2 min read
The resume() method of ThreadGroup class is used to resume all threads in the thread group which was suspended using suspend() method. Syntax public final void resume() Return public final void resume() Exception SecurityException: This exception throws if the current thread is not allowed to access the thread group or any of...
2 min read
The activeGroupCount() method of ThreadGroup class returns an estimate of the number of active groups in this thread group and its subgroups. The returned value is only an estimate because the number of thread groups may change dynamically while this method traverses internal data structures. Syntax public int...
2 min read
The getMaxPriority() method of ThreadGroup class returns the maximum priority of the thread group. Syntax: public final int getMaxPriority() Return: This method returns the maximum priority that a thread in the thread group can have Example class NewThread extends Thread { NewThread(String threadname, ThreadGroup tg) { ...
2 min read
The interrupt() method of ThreadGroup class is used to interrupt all the threads in the thread group. Syntax public final void interrupt() Return This method does not return any value. Exception SecurityException: This exception throws if the current thread is not allowed to access the thread group or any of the threads...
3 min read
The destroy() method of ThreadGroup class is used to destroy the thread group and all of its subgroups. The thread group must be empty, indicating that all threads that had been in the thread group have since stopped. Syntax: public void destroy() Return: It doesn't return any value. Exception: IllegalThreadStateException: This exception...
3 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India