What is the purpose of the try-catch block in Java?
The try-catch block is used to stop exceptions from happening in the code.
Actually, the try-catch block doesn't prevent exceptions, it just handles them if they occur.
Can you explain how the program behaves if an exception occurs inside the try block?