- Kotlin for Enterprise Applications using Java EE
- Raghavendra Rao K
- 100字
- 2025-02-27 20:51:34
No checked exceptions
In Java, exception handling is tedious and controlled by strict rules. Whenever we are dealing with checked exceptions, we can either handle exceptions in try…catch blocks, or they can be declared to be thrown. In this case, the code is repeated. Kotlin doesn't have any checked exceptions. The Exception class is extended from the java.lang.Exception class of the JDK library via typealias. We don't have to declare or handle the exceptions, thereby reducing a lot of boilerplate code.
Kotlin also provides other benefits, as explained in the following subsections.