From f656c6190340d3e19ef7951ff3e3cf786831ffda Mon Sep 17 00:00:00 2001 From: dev-chirag Date: Tue, 15 Jun 2021 22:51:00 +0530 Subject: [PATCH] BAEL4235 FindNumberOfThread class --- .../threads/number/FindNumberOfThreads.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/threads/number/FindNumberOfThreads.java diff --git a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/threads/number/FindNumberOfThreads.java b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/threads/number/FindNumberOfThreads.java new file mode 100644 index 0000000000..24c897fd11 --- /dev/null +++ b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/threads/number/FindNumberOfThreads.java @@ -0,0 +1,12 @@ +package com.baeldung.concurrent.threads.number; + +import java.lang.management.ManagementFactory; + +public class FindNumberOfThreads { + + public static void main(String[] args) { + System.out.println("Number of threads " + Thread.activeCount()); + System.out.println("Current Thread Group - " + Thread.currentThread().getThreadGroup().getName()); + System.out.println("Total Number of threads " + ManagementFactory.getThreadMXBean().getThreadCount()); + } +}