Java Thread enumerate() methodThe enumerate() method of thread class is used to copy every active thread's thread group and its subgroup into the specified array. This method calls the enumerate method with the tarray argument. This method uses the activeCount method to get an estimate of how big the array should be. If the length of the array is too short to hold all the threads, the extra threads are silently ignored. SyntaxParametertarray: This method is an array of Thread objects to copy to. ReturnThis method returns the number of threads put into the array. ExampleTest it NowOutput: Starting of Thread-1 Starting of Thread-2 Thread-1 found Thread-2 found Thread-1 completed executing Thread-2 completed executing Next TopicMultithreading Java |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India