What is the purpose of the try-catch block in Java?
The try-catch block in Java is used to catch and handle exceptions. The code that may throw an exception is placed inside the try block, and the catch block contains the code to handle the exception.
Exactly! You've accurately described the role of try-catch blocks in exception handling.
Can you provide an example where a try-catch block is useful?