And if u know how do those stacks work I would be really glad if you could tell me how , I now idea of stack I know how it should work but I just not know what this code mean for example StackTraceElement[] stack = Thread.currentThread().getStackTrace(); ? if smb could tell me in easy way with easy words just code and this method element.getLineNumber() and this one
for (StackTraceElement element : sladStosuElementy)
{
System.out.println(element.getMethodName());
}
or if there is any article about it said in easy way . I repeat I know the idea of stack and how it should work I just rly don't understand those codes :(
package pl.codegym.task.task09.task0903;
/*
Kto mnie wywołał?
*/
public class Solution {
public static void main(String[] args) throws Exception {
method1();
}
public static int method1() {
method2();
return 0;
}
public static int method2() {
method3();
return element.getLineNumber(13) ;
}
public static int method3() {
method4();
return element.getLineNumber(18) ;
}
public static int method4() {
method5();
return element.getLineNumber(23) ;
}
public static int method5() {
return element.getLineNumber(28) ;
}
}