What is Kotlin

What is Kotlin?

Kotlin is a modern, statically typed programming language created by JetBrains (the company behind IntelliJ IDEA and Android Studio). Version 1.0 came out in 2016. It runs on the Java Virtual Machine (JVM), so it can use every Java library, and it can also be compiled to JavaScript and to native code.

  • Concise: the same logic usually needs 30–40% fewer lines than Java.
  • Safe: null is part of the type system, so most NullPointerException crashes are caught while compiling.
  • Interoperable: Kotlin and Java files can live in the same project and call each other.
  • Multi-purpose: Android apps, backend servers (Spring Boot, Ktor), desktop apps and shared mobile code (Kotlin Multiplatform).

Hello, Kotlin

Example

Every Kotlin program starts at a top-level main function. No class is needed, and semicolons are optional.

fun main() {
    println("Hello, Kotlin!")
    println("Kotlin runs on the JVM")
}

Output

Hello, Kotlin!
Kotlin runs on the JVM

A Short History

YearEvent
2011JetBrains announces Project Kotlin (named after Kotlin Island near St. Petersburg)
2016Kotlin 1.0 released
2017Google announces official Kotlin support for Android
2019Google declares Android development Kotlin-first
2024Kotlin 2.0 with the new K2 compiler (much faster builds)