import java.awt.*;

public class ThreadInfo {	
	public static void main(String[] argv) {
		Frame wnd;
		if (argv.length == 1) {
			if (argv[0].compareTo("-gui") == 0) {
			 	wnd = new Frame("Einfaches Fenster");
				wnd.setSize(400,300);
      		wnd.setVisible(true);
      	} //if
      } //if
		ThreadGroup tg = null;
		ThreadGroup tgTmp = Thread.currentThread().getThreadGroup();
		
		do {
			tg = tgTmp;
			tgTmp = tgTmp.getParent();
		} while (tgTmp != null);
		
		int noActiveThreads = tg.activeCount();
		
		Thread[] tList = new Thread[noActiveThreads];
		
		noActiveThreads = tg.enumerate(tList,true);
		for (int i=0; i<noActiveThreads; i++) {
			System.out.println("Thread Group: "   +tList[i].getThreadGroup().getName()+"\n"+
			                   "Thread Name: "    +tList[i].getName()+"\n"+
			                   "Thread Priority: "+tList[i].getPriority()+"\n"+
			                   "isDaemon: "       +tList[i].isDaemon()+"\n");
		} //for
		System.exit(0);
	} // main()
} //class ThreadInfo		