Question 3: What's the difference between `try-catch` and `try-catch-finally` in Kotlin?

Responsive Ad Header

Question

Grade: Education Subject: Support
Question 3: What's the difference between `try-catch` and `try-catch-finally` in Kotlin?
Asked by:
88 Viewed 88 Answers

Answer (88)

Best Answer
(264)
The `try-catch` block handles exceptions during the execution of a `try` block. The `try-catch-finally` block handles exceptions both during the execution of a `try` block and after the `try` block completes, ensuring resources are released even in case of errors.