Introduction
- When we have any function at run time when its execution starts it gets loaded in the stack, as soon as its execution is over the method is taken out.
- In Java main is also a function.
- As all functions are loaded on the stack for their execution, the same main method is also loaded.
- The length of the stack is always fixed, if we try to execute it we will get a stack overflow error.
- When we make a call to main inside the main function, what will happen is we will get stack overflow error.
- Here what is happening is everytime when we also called main , like a recursive calls.
- Infinite number of recursive calls without a break will lead to stack overflow error.