Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
for (Thread thread: threadSet) {
System.out.println(thread.getId());
}
Make sure you read and understand the method Thread.getAllStackTraces() before using them.Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
for (Thread thread: threadSet) {
System.out.println(thread.getId());
}
Make sure you read and understand the method Thread.getAllStackTraces() before using them.Labels: Interview Questions
0 comments:
Post a Comment