Question: Explain the 'try', 'catch', 'finally' and 'throw' keywords in Java.Answer: 'try' is used to enclose a block of code where exceptions might occur. 'catch' is used to handle exceptions. 'finally' is used to define a block of code that will be executed whether an exception is thrown or not. 'throw' is used to explicitly throw an exception. |
Is it helpful?
Yes
No
Most helpful rated by users: