What Is Kotlin?

A concise, null-safe language for Android, the JVM backend and beyond — fully interoperable with Java.

Kotlin is a statically typed language created by JetBrains (the company behind IntelliJ IDEA), released as 1.0 in 2016. In 2019 Google made it the preferred language for Android development, and today most professional Android apps are written in it. It runs on the Java Virtual Machine and can use every Java library, but needs far less code than Java and removes the most common Java crash, the NullPointerException, through its type system.

First program

val declares a read-only variable; the type (String) is inferred.

"$language" inserts a variable into a string; "${2 + 3}" inserts any expression.

String.format works through "...".format(...).

Kotlin compared with Java

public static void main(String[] args) {... } // Java style fun main() {... }

Kotlin needs no class around main; fun main(args: Array<String>) is also allowed if you need the arguments.

Can Kotlin use Java libraries?

Yes. Kotlin is fully interoperable with Java on the JVM: Kotlin code calls Java classes directly and Java code can call Kotlin.