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.
In the blue depths of the stack trace…
You must be signed in to leave a comment
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.
2 August 2021, 08:54
CodeGym, please look at the exercise star rating and the comments. This Level needs more instruction.
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.
18 October 2020, 18:57
Intelij Idea shows me output 3 but CodeGym shows me output 12... How have I understand it?
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.
27 July 2020, 00:53
Don't know how I'm completing these tasks without understanding much.
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 Consultants
31 January 2020, 20:40
I am completing these easily enough, but can't tell if I am learning anything
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.
15 May 2019, 09:24
Why the Stack depth is 12 ?
15 May 2019, 11:35
who said it's 12?
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?
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
15 May 2019, 21:53
Okay. I am posting it.
15 May 2019, 21:59
Posted a question with the code. Please check and tell me. Thank you.
16 May 2019, 06:21