In the blue depths of the stack trace…

  • 3
  • Locked
Remember the golden rule: function A calls function B, which calls function C. And to exit A, you must first exit B, and to do that you must exit C. Got it? Good. And now we'll write a method that returns the stack trace depth, i.e. the number of methods in the stack trace. And one more thing: display this number on the screen.
You can't complete this task, because you're not signed in.
Comments (18)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Sander verhulst
Level 17 , United Kingdom
3 September 2022, 19:59
I am not learning anything like this, i understand letting us do some googling but there is just way to less information on this topic.
Anonymous #10775689
Level 14 , United Kingdom
2 August 2021, 08:54
CodeGym, please look at the exercise star rating and the comments. This Level needs more instruction.
ImDevin
Level 15 , Old Town, United States
6 May 2021, 13:18
just getting it done. intellij doesn't give me any output. don't know why. for-each loop through StackTraceElement with .getMethodName does show 12 elements.
Vitalina
Level 20 , Poland
18 October 2020, 18:57
Intelij Idea shows me output 3 but CodeGym shows me output 12... How have I understand it?
Switch/Cypher
Level 25 , Bexleyheath, United Kingdom
19 September 2020, 09:50
I'm completing these tasks with a lot of google and looking at the comments. I totally understand how the stacktrace works, but the programming terminology hasn't been explained AT ALL.
Petros
Level 23 , Columbia, United States
27 July 2020, 00:53
Don't know how I'm completing these tasks without understanding much.
Rafal Pawlowski
Level 15 , Swaythling, United Kingdom
20 June 2020, 13:56
For everyone who is thinking why depth is equal some number use for each loop to print out stack trace to find out why is it so deep :)
Kent Hervey Software Engineer/Consult at Zeal IT ConsultantsExpert
31 January 2020, 20:40
I am completing these easily enough, but can't tell if I am learning anything
Trevor
Level 23 , Phoenix, United States
19 December 2019, 21:56
It's silly to have this fail when everything is right, but you called System.out in the 'wrong' method.
Khairul
Level 11
15 May 2019, 09:24
Why the Stack depth is 12 ?
Ahmed
Level 23 , Amsterdam, Netherlands
15 May 2019, 11:35
who said it's 12?
Khairul
Level 11
15 May 2019, 12:11
element.length gives the value 12. So, doesn't it mean that the stack depth is 12? Please also clarify why the value is 12 and what is the actual stack depth?
Ahmed
Level 23 , Amsterdam, Netherlands
15 May 2019, 12:55
I solved the problem and i didn't get 12. Put your code in the help session and i will help you
Khairul
Level 11
15 May 2019, 21:53
Okay. I am posting it.
Khairul
Level 11
15 May 2019, 21:59
Posted a question with the code. Please check and tell me. Thank you.
Ahmed
Level 23 , Amsterdam, Netherlands
16 May 2019, 06:21
Sure.