After going through the feature richness of Kotlin, it would be really helpful to compare it to Java. This is not to prove a particular language is more appropriate than the other, but rather to just list the differences to make the choice easier for different scenarios:
- Null safety: Kotlin provides a nice way to define and handle nullable types, whereas Java does not have a similar feature out of the box.
- Extension function: Java needs an inheritance to extend the class, whereas Kotlin allows you to define the extension function without inheriting any class. You can define an extension function for custom classes as well.
- Type reference: In Java, we need to specify the type of variable explicitly, but Kotlin will handle ...