Quick Facts - Kotlin does not need
; to end statements - Kotlin is null-safe
- Kotlin is 100% Java interoperable
- Kotlin has no primitives (but optimizes their object counterparts for the JVM, if possible)
- Kotlin classes have properties, not fields
- Kotlin offers data classes with auto-generated
equals/hashCode methods and field accessors - Kotlin only has runtime Exceptions, no checked Exceptions
- Kotlin has no
new keyword. Creating objects is done just by calling the constructor like any other method. - Kotlin supports (limited) operator overloading. For example, accessing a value of a map can be written like:
val a = someMap["key"] - Kotlin can not only be compiled to byte code for the JVM, but also into Java Script, enabling you to write both backend and frontend code in Kotlin
- Kotlin is fully compatible with Java 6, which is especially interesting in regards for support of (not so) old Android devices
- Kotlin is an officially supported language for Android development
- Kotlin's collections have built-in disctinction between mutable and immutable collections.
- Kotlin supports Coroutines (experimental)
|
| IF, TRY and others are expressions, not statements In Kotlin, if, try and others are expressions (so they do return a value) rather than (void) statements. So, for example, Kotlin does not have Java's ternary Elvis Operator, but you can write something like this: Even more unfamiliar, but equally expressive, is the try expression: |