Returns total number of active threads in a string with header. - Java java.lang

Java examples for java.lang:Thread

Description

Returns total number of active threads in a string with header.

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getThreadCountString());
    }//from   w  w  w . j av  a  2 s .  c  o m

    /**
     * Returns total number of active threads in a string with header.
     */
    public static String getThreadCountString() {
        return "Total number of active threads: " + Thread.activeCount();
    }
}

Related Tutorials