Displaying a stack trace

  • 4
  • Locked
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.
You can't complete this task, because you're not signed in.
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Anonymous #11016365
Level 39 , Detroit, United States
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?
Олег Байбула
Level 32 , Ukraine
23 January, 09:10
The purpose of the for-each loop is to print every element of the array produced by getStackTrace() method.