JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* check it in comment section
https://www.sololearn.com/Discuss/2476526/?ref=app
Most of the times StackOverflowError occurred
1.)when a method call itself without termination.
2).when you have insufficient storage in stack area(it's depending on your Operating System)
3).when circular dependencies exist in between classes. For example, A->B->C->A.
Ok let's move in to your code....
As we know In JAVA , each and every source code is execution starts from main()method called by JVM.
As usual your program also executed from main() method.
After calling main method, JVM create one stack frame for main()method inside stack area.
I.e., just assume
_________ |
|_________| |
|_________| |
|_________| |
|_________| |
|_main()__| |
|
STACK AREA | HEAP AREA
Now,Inside main() method executes
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run