Why We are throwing Exception In Main Function For Stack?
Thowing Exception In Stack
Java requires that you handle or declare all exceptions. If you are not handling an Exception using a try/catch block then it must be declared in the method’s signature.