Do you still remember about the stack trace and the fact that the currently running method is at the top of the stack? Let's recall this by completing a task: you need to create a "task" (a public static class called SpecialThread that implements the Runnable interface). SpecialThread should display its own stack trace.
Displaying a stack trace
- 4
Locked
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Anonymous #11016365
3 September 2022, 20:04
I'm not sure I understand how to read the result of this exercise. Is the purpose just to show that each thread has its own stack trace? If so, what is the purpose of the for loop?
0
Олег БайбулаExpert
23 January, 09:10
The purpose of the for-each loop is to print every element of the array produced by getStackTrace() method.
0