前面大致的了解了Thread的一些方法和属性下面对一些方法进行运用看看具体效果<下面可能还是会贴很多的源代码,其实我是拒绝的,我只想贴每个方法的代码,但是有时候看到一个方法里面有调用了方法,但是笔者有没有给出来,很蛋疼,有种爽到一半的感觉,所以我还是会把它贴出来,希望一次就能挖到底,不论有没有全懂,但至少懂了几分。>
activeCount():返回当前线程所属线程组的活动线程数
源代码如下:
1 /** 2 * Returns an estimate of the number of active threads in the current 3 * thread's {@linkplain java.lang.ThreadGroup thread group} and its 4 * subgroups. Recursively iterates over all subgroups in the current 5 * thread's thread group. 6 * 7 * <p> The value returned is only an estimate because the number of 8 * threads may change dynamically while this method traverses internal 9 * data structures, and might be affected by the presence of certain10 * system&


