The java throw keyword is used to explicitly throw an exception. We can throw either checked or unchecked exception in java by throw keyword. The throw keyword is mainly used to throw custom exception.
One try catch block can be present in the another try’s body. This is called nesting of try catch blocks. Each time a try block does not have a catch handler for a particular exception the stack is unwound and the next try block’s catch handlers are
Try block is used to enclose the code that might throw exception. It must be used within method. Try block must be followed by either catch or finally block.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy
Join MindStick Community
You have need login or register for voting of answers or question.