Kotlin
A general-purpose, statically typed programming language developed by JetBrains. Designed for full interoperability with Java; the official language for Android development and a target for cross-platform development through Kotlin Multiplatform.
- Paradigms
- imperative · OOP · functional
- Typing
- static
- Memory
- gc
- Version
- 2.1
- First released
- 2011
Kotlin is a general-purpose, statically typed programming language developed by JetBrains and intended primarily as a more concise and safer alternative to Java that retains full interoperability with the Java ecosystem. The principal target is the Java Virtual Machine (JVM), where Kotlin code compiles to bytecode that calls into and is callable from Java without intermediate marshalling. Additional compilation targets are provided by Kotlin/JS, which emits JavaScript, and Kotlin/Native, which compiles to native binaries through LLVM. The language adds null safety to the type system, replaces the JavaBeans property convention with first-class language properties, supports data classes and sealed type hierarchies as first-class constructs, and integrates coroutines — cooperatively scheduled suspend functions — for concurrency. Google designated Kotlin as the official language for Android application development in 2017, alongside the existing support for Java.
History
Kotlin was announced by JetBrains in July 2011, with development underway since 2010 under the project name Project Kotlin, after the Russian island of Kotlin. Kotlin 1.0 shipped in February 2016 and committed to source and binary compatibility within the 1.x line. Subsequent minor revisions were issued at an approximately six-month cadence: Kotlin 1.3 (2018) introduced stable coroutines; Kotlin 1.4 (2020) introduced contracts and refined inline classes; Kotlin 1.5 standardised inline value classes; Kotlin 1.7 stabilised the K2 compiler in alpha; Kotlin 1.9 (2023) further matured K2. Kotlin 2.0 (2024) shipped K2 as the default compiler — a substantially redesigned front end that improved compilation time and diagnostic quality without altering the language semantics. The current release is Kotlin 2.1.
Hello world
fun main() {
println("Hello, world!")
}
Build and execution with the standard toolchain:
kotlinc hello.kt -include-runtime -d hello.jar
java -jar hello.jar
The -include-runtime flag bundles the Kotlin standard library into the resulting JAR, producing a self-contained executable. Production projects conventionally use Gradle (with the Kotlin DSL build.gradle.kts or the Groovy DSL build.gradle) or Maven as the build system; both have first-class support for compiling Kotlin together with Java sources within a single project. Kotlin Multiplatform projects share Kotlin sources across multiple platform targets through a Gradle plugin, with platform-specific code expressed through expect/actual declarations.