Introduction
Kotlin, from JetBrains, is officially Google's preferred language for Android development, and it also runs anywhere Java runs, because it compiles to the same JVM bytecode. Think of it as Java with a decade of lessons applied: less boilerplate, safer handling of missing values, and modern features built in.
If you know Java, Kotlin will feel like a friendlier dialect of it. If you do not, it is an excellent first JVM language.
Null safety: the billion-dollar mistake, fixed
Java's most famous problem is the NullPointerException β using a value that turns out to be null. Kotlin tackles it in the type system, like Swift's optionals: a type either can or cannot be null, and the compiler enforces the difference.
var name : String = "Sara" // name = null // Error: null cannot be a value of String var nickname : String ? = null println ( nickname ?. length ) // Safe call: prints null, no crash println ( nickname !! .β¦