public class ThreadGroupExamp {
public static void main(String[] args) {
ThreadGroup system = Thread.currentThread().getThreadGroup();
Thread[] threads = new Thread[system.activeCount()];
system.enumerate(threads);
for(Thread t:threads){
if (t != null && t.getThreadGroup() == system) {
System.out.println("Thread Name: " + t.getName());
}
}
}
}