Problem Statement
Explain the concept of try-with-resources (or similar constructs) and how it simplifies resource management.
Explanation
In languages like Java you can use try-with-resources which automatically closes the resource at the end of the block, whether an exception was thrown or not. This reduces boilerplate finally code and prevents resource leaks. For example: `try (BufferedReader br = new BufferedReader(new FileReader(path))) { … }` ensures `br` is closed automatically. This pattern simplifies error-safe resource handling and is preferred in modern code.