DEV/DEV3.2/TP6/Traces/Main.java

23 lines
777 B
Java
Raw Normal View History

2023-11-29 17:27:03 +01:00
import java.util.*;
public class Main {
public static void main (String[] args){
2024-11-27 11:35:15 +01:00
Map<Thread, StackTraceElement[]> dico = Thread.getAllStackTraces();
Set<Map.Entry<Thread, StackTraceElement[]>> tab = dico.entrySet();
Iterator<Map.Entry<Thread, StackTraceElement[]>> ite = tab.iterator();
for (; ite.hasNext(); ) {
Map.Entry<Thread, StackTraceElement[]> entry = ite.next();
Thread thread = entry.getKey();
StackTraceElement[] stackTrace = entry.getValue();
System.out.println(thread.getName() + " :");
for (StackTraceElement element : stackTrace) {
System.out.println(" " + element);
}
System.out.println();
2023-11-29 17:27:03 +01:00
}
}
2024-11-27 11:35:15 +01:00
}