Java tutorial
class ThreadDemo extends Thread { public void run() { // returns the thread group to which this thread belongs System.out.println(getThreadGroup()); } } public class Main { public static void main(String[] args) { ThreadGroup tgrp = new ThreadGroup("Thread Group"); Thread t = new Thread(tgrp, new ThreadDemo()); t.start(); } }