Why is the answer not 12 for each of the things in the array?
package com.codegym.task.task09.task0905;
/*
In the blue depths of the stack trace…
*/
public class Solution {
public static void main(String[] args) throws Exception {
int deep = getStackTraceDepth();
}
public static int getStackTraceDepth() {
// write your code here
StackTraceElement[] element = Thread.currentThread().getStackTrace();
System.out.println("Element: " + element.length);
for (int i = 0; i < element.length; i++) {
System.out.println(i + ": " + element[i]);
}
return element.length;
}
}