Kotlin
| Kotlin | |
|---|---|
| Paradigms | Multi-paradigm: object-oriented, functional, imperative, block structured, generic, reflective, concurrent |
| Family | JVM-hosted |
| Designed by | Andrey Breslav, JetBrains |
| Developer | JetBrains |
| First appeared | 22 July 2011 |
| Stable release | |
| Typing discipline | Inferred, static, strong |
| Platform |
|
| OS | Cross-platform |
| License | Apache 2.0 |
| Filename extensions | .kt, .kts, .kexe, .klib |
| Website | kotlinlang |
| Influenced by | |
| Influenced | |
| V (Vlang) |
Kotlin (/ˈkɒtlɪn/)[3] is a cross-platform, statically typed, general-purpose high-level programming language with type inference. Kotlin is designed to interoperate fully with Java, and the Java virtual machine (JVM) version of Kotlin's standard library depends on the Java Class Library. Type inference allows for more concise syntax than Java, while null-safety features reduce a common class of runtime errors. Kotlin mainly targets the JVM, but also compiles to JavaScript (e.g., for frontend web applications using React)[4] or native code via LLVM (e.g., for native iOS apps sharing business logic with Android apps).[5] JetBrains bears language development costs, while the Kotlin Foundation protects the Kotlin trademark.[6][7]
On 7 May 2019, Google announced Kotlin had become its preferred language for Android app developers.[8] As of 2024, over 95% of the top 1,000 Android apps on Google Play contain Kotlin code. In May 2024, JetBrains released Kotlin 2.0 featuring the new K2 compiler—a complete rewrite offering up to twice the compilation speed of its predecessor—as well as stabilised support for Kotlin Multiplatform.[9] That same month, Google formally endorsed Kotlin Multiplatform at Google I/O 2024, recommending it as the approach for sharing business logic across Android, iOS, and other platforms.[10]
History
[edit]

Name
[edit]The name is derived from Kotlin Island, a Russian island in the Gulf of Finland, near Saint Petersburg. Andrey Breslav, Kotlin's former lead designer, mentioned that the team decided to name it after an island, in imitation of the Java programming language, which shares a name with the Indonesian island of Java.[11]
Development
[edit]The first commit to the Kotlin Git repository was on 8 November 2010.[12]
In July 2011, JetBrains unveiled Project Kotlin, a new JVM language that had been under development for a year.[13][14] JetBrains lead Dmitry Jemerov said that most languages lacked the features they were looking for, except for Scala. However, he cited Scala's slow compilation time as a deficiency.[14] One of Kotlin's stated goals is to compile as quickly as Java. In February 2012, JetBrains open-sourced the project under the Apache 2 license.[15]
Kotlin 1.0 was released on 15 February 2016, which is considered the first officially stable release, and JetBrains has committed to long-term backwards compatibility starting with this version.[16]
At Google I/O 2017, Google announced first-class support for Kotlin on Android.[6] On 7 May 2019, Google announced that Kotlin is now its preferred language for Android app developers.[8]
In November 2023, Kotlin/Native was declared stable with version 1.9.20, enabling production-ready compilation to native binaries for iOS, macOS, Linux, and Windows without a JVM.[17][18] Kotlin Multiplatform (KMP), which allows sharing business logic across Android, iOS, server, and desktop from a single codebase, also reached stable status in November 2023.[19][20][21]
In May 2024, JetBrains released Kotlin 2.0 at KotlinConf 2024 as the most significant release in the language's history. The centrepiece was the stable K2 compiler—a complete rewrite of the original compiler frontend from scratch—which unifies all target platforms (JVM, JavaScript, WebAssembly, and Native) into a single pipeline.[9] The K2 compiler was validated against 10 million lines of code across 80,000 projects by more than 18,000 developers before release.[9] Benchmarks showed compilation speed improvements of up to 94% in some projects, with the analysis phase up to 376% faster than the previous compiler.[22] Also in May 2024, Google officially endorsed Kotlin Multiplatform at Google I/O 2024, announcing first-class tooling and library support for KMP on Android, and revealing that Google Workspace uses KMP for the shared business logic of Google Docs across Android, iOS, and web.[23]
Design
[edit]Development lead Andrey Breslav has said that Kotlin is designed to be an industrial-strength object-oriented language, a "better language" than Java, and still fully interoperable with Java code, allowing companies to make a gradual migration from Java to Kotlin.[24]
Semicolons are optional as a statement terminator; in most cases, a newline is sufficient for the compiler to deduce that the statement has ended.[25]
Kotlin variable declarations and parameter lists place the data type after the variable name (separated by a colon), similar to Ada, BASIC, Pascal, TypeScript, and Rust. This, according to an article from Roman Elizarov, current project lead, results in alignment of variable names and is more pleasing to the eyes, especially when there are a few variable declarations in succession, and one or more of the types are too complex for type inference, or need to be declared explicitly for human readers to understand.[26][27]
The influence of Scala in Kotlin can be seen in the extensive support for both object-oriented and functional programming[28] and in several specific features:
- There is a distinction between mutable and immutable variables (var vs val keyword)
- All classes are public and final (non-inheritable) by default
- Functions and methods support default arguments, variable-length argument lists, and named arguments
Kotlin 1.3 added support for contracts,[29] which are stable for the standard library declarations, but still experimental for user-defined declarations. Contracts are inspired by the design-by-contract[30] programming paradigm.
Like Scala.js, Kotlin code can be transpiled to JavaScript, enabling interoperability between Kotlin and JavaScript and allowing either writing complete web applications in Kotlin or sharing code between a Kotlin backend and a JavaScript frontend.[31]
Syntax
[edit]Procedural programming style
[edit]Kotlin relaxes the Java restriction on static methods and variables, allowing them to exist outside a class body. Static objects and functions can be defined at the top level of the package without requiring a redundant class-level scope. For compatibility with Java, Kotlin provides the JvmName annotation, which specifies the class name used when the package is viewed from a Java project. For example, @file:JvmName("JavaClassName").
Main entry point
[edit]As in C, C++, C#, Java, and Go, the entry point to a Kotlin program is a function named main, which may be passed an array containing any command-line arguments. This is optional since Kotlin 1.3.[32] Perl, PHP, and Unix shell–style string interpolation is supported. Type inference is also supported.
// Hello, World! example
fun main() {
val scope = "World"
println("Hello, $scope!")
}
fun main(args: Array<String>) {
for (arg in args) {
println(arg)
}
}
Visibility modifiers
[edit]Kotlin provides the following keywords to restrict visibility for top-level declarations (such as classes) and for class members: public, internal, protected, and private.
When applied to a class member:
| Keyword | Visibility |
|---|---|
public (default) | Everywhere |
internal | Within a module |
protected | Within subclasses |
private | Within a class |
When applied to a top-level declaration:
| Keyword | Visibility |
|---|---|
public (default) | Everywhere |
internal | Within a module |
private | Within a file |
Example:
// Class is visible only to current module
internal open class TalkativeButton {
// method is only visible to current class
private fun yell() = println("Hey!")
// method is visible to current class and derived classes
protected fun whisper() = println("Let's talk!")
}
internal class MyTalkativeButton: TalkativeButton() {
fun utter() = super.whisper()
}
MyTalkativeButton().utter()
Null safety
[edit]Kotlin distinguishes between nullable and non-nullable data types. All nullable objects must be declared with a "?" postfix after the type name. Operations on nullable objects need special care from developers: a null-check must be performed before using the value, either explicitly, or with the aid of Kotlin's null-safe operators:
- ?. (the safe navigation operator) can be used to safely access a method or property of a possibly null object. If the object is null, the method will not be called, and the expression evaluates to null. Example:
// returns null if... // - foo() returns null, // - or if foo() is non-null, but bar() returns null, // - or if foo() and bar() are non-null, but baz() returns null. // vice versa, return value is non-null if and only if foo(), bar() and baz() are non-null foo()?.bar()?.baz()
- ?: (the null coalescing operator) is a binary operator that returns the first operand, if non-null, else the second operand. It is often referred to as the Elvis operator, due to its resemblance to an emoticon representation of Elvis Presley.
fun sayHello(maybe: String?, neverNull: Int) { // use of Elvis operator val name: String = maybe ?: "stranger" println("Hello $name") }
Lambdas
[edit]Kotlin supports higher-order functions and anonymous functions, or lambdas.[33]
Lambdas are declared using braces, { }. If a lambda takes parameters, they are declared within the braces and followed by the -> operator.
// the following statement defines a lambda that takes a single parameter and passes it to the println function
val l = { c : Any? -> println(c) }
// lambdas with no parameters may simply be defined using { }
val l2 = { print("no parameters") }
Tools
[edit]- Android Studio (based on IntelliJ IDEA) has official support for Kotlin since Android Studio 3.[34]
- Integration with common Java build tools is supported, including Apache Maven,[35][36] Apache Ant,[37][38] and Gradle.[39]
- Emacs has a Kotlin Mode in its MELPA package repository.[40]
- JetBrains also provides a plugin for Eclipse.[41]
- IntelliJ IDEA has plugin-based support for Kotlin.[42][43] IntelliJ IDEA 15 was the first version to bundle the Kotlin plugin in the IntelliJ Installer and to provide Kotlin support out of the box.[44]
- Kotlin integrates seamlessly with Gradle, a build automation tool.[45][46]
Kotlin Multiplatform
[edit]Kotlin Multiplatform enables a single codebase to target multiple platforms, including Windows, Linux, the web, Android, and iOS.[47][48]
KMP reached stable status in November 2023, and at Google I/O 2024, Google recommended it as the standard approach for sharing business logic across Android and iOS, also disclosing that Google Workspace uses KMP for the shared layer of Google Docs on Android, iOS, and web.[10]
Compose Multiplatform is an open-source, declarative framework for sharing UIs across multiple platforms – Android, iOS, web and desktop. It is based on Jetpack Compose and Kotlin Multiplatform.[49][50][51] Jetpack Compose uses a Kotlin compiler plugin to transform composable functions into UI elements.[52] For example, the Text composable function displays a text label on the screen.
Adoption
[edit]In 2018, Kotlin was the fastest-growing language on GitHub, with 2.6 times as many developers as in 2017.[53] It is the fourth-most-loved programming language according to the 2020 Stack Overflow Developer Survey.[54] In GitHub’s 2024 Octoverse report, Kotlin ranked fifth among the fastest-growing programming languages on the platform.[55]
Kotlin was also awarded the O'Reilly Open Source Software Conference Breakout Award for 2019.[56]
A large number of companies in various industries use Kotlin, including Google, Amazon Web Services, Booking.com and McDonald's.[57] Organisations using KMP in production include Forbes, Philips, McDonald's, and Square.[58]
According to the 2024 Stack Overflow Developer Survey, Kotlin ranked among the top admired programming languages, with approximately 57% of developers who used it in the prior year wishing to continue doing so.[59] The JetBrains Developer Ecosystem Survey 2024, conducted among more than 23,000 developers worldwide, found that Kotlin ranked among the highest-paid programming languages globally, alongside Scala, Go, and Rust.[60]
Applications
[edit]When Kotlin was announced as an official Android development language at Google I/O in May 2017, it became the third language fully supported for Android, after Java and C++.[61] Kotlin on Android is seen as beneficial for its null-safety and features that make code shorter and more readable.[62]
Ktor is a JetBrains Kotlin-first framework for building server and client applications.[63][64] The Spring Framework officially added Kotlin support with version 5, on 4 January 2017.[65] To further support Kotlin, Spring has translated all its documentation into Kotlin and added built-in support for many Kotlin-specific features, such as coroutines.[66]
In 2020, JetBrains found in a survey of developers who use Kotlin that 56% used it for mobile apps, while 47% used it for a web backend. Just over a third of all Kotlin developers said they were migrating from another language. Most Kotlin users targeted Android (or the JVM), with only 6% using Kotlin Native.[67]
As of 2024, over 95% of the top 1,000 Android apps on Google Play contain Kotlin code.[68]
By 2024, with Kotlin Multiplatform reaching stable status, that picture had shifted: a 2024 community survey of KMP developers found that nearly a quarter of respondents had adopted KMP within the prior six months, indicating strong recent growth, while a further 21% had used it for between one and three years. Google also reported at KotlinConf 2024 that it had migrated the shared business logic of Google Docs to KMP, running in production across Android, iOS, and the web.[69]
See also
[edit]References
[edit]- This article contains quotations from Kotlin tutorials which are released under an Apache 2.0 license.
- ↑ "Release Kotlin 2.4.0". 3 June 2026. Retrieved 15 June 2026.
- ↑ "Kotlin/Native target support | Kotlin". Kotlin Help. Retrieved 16 October 2025.
- ↑ "What is the correct English pronunciation of Kotlin?". 16 October 2019. Archived from the original on 9 November 2019. Retrieved 9 November 2019.
- ↑ "Kotlin for JavaScript - Kotlin Programming Language". Kotlin. Archived from the original on 16 August 2020. Retrieved 20 August 2020.
- ↑ "Kotlin for cross-platform mobile development". JetBrains: Developer Tools for Professionals and Teams. Archived from the original on 19 August 2020. Retrieved 20 August 2020.
- 1 2 Miller, Paul (17 May 2017). "Google is adding Kotlin as an official programming language for Android development". The Verge. Retrieved 14 July 2026.
- ↑ "Kotlin Foundation - Kotlin Programming Language". Kotlin. Archived from the original on 29 December 2019. Retrieved 16 December 2019.
- 1 2 Lardinois, Frederic (7 May 2019). "Kotlin is now Google's preferred language for Android app development". TechCrunch. Archived from the original on 7 May 2019. Retrieved 8 May 2019.
- 1 2 3 De Simone, Sergio (27 May 2024). "Kotlin 2.0 Launched with New, Faster, More Flexible K2 Compiler". InfoQ. Retrieved 14 July 2026.
- 1 2 "Android Support for Kotlin Multiplatform (KMP) to Share Business Logic Across Mobile, Web, Server, and Desktop". Android Developers. 14 May 2024. Retrieved 14 July 2026.
- ↑ Mobius (8 January 2015), Андрей Бреслав – Kotlin для Android: коротко и ясно, archived from the original on 12 April 2023, retrieved 28 May 2017
- ↑ "test · JetBrains/kotlin@3e4dce3". GitHub. Archived from the original on 17 October 2022. Retrieved 17 October 2022.
- ↑ Stal, Michael (23 July 2011). "JetBrains introduces the new JVM language Kotlin". InfoQ. Retrieved 14 July 2026.
- 1 2 Krill, Paul (22 July 2011). "JetBrains readies JVM language Kotlin". InfoWorld. Archived from the original on 7 September 2019. Retrieved 2 February 2014.
- ↑ Waters, John (22 February 2012). "Kotlin Goes Open Source". ADTmag.com. 1105 Enterprise Computing Group. Archived from the original on 18 February 2014. Retrieved 2 February 2014.
- ↑ Pérez, Marín (18 February 2016). "JetBrains Releases Kotlin 1.0". InfoQ. Retrieved 14 July 2026.
- ↑ Anderson, Tim (1 November 2023). "JetBrains offers first stable release of Kotlin Multiplatform". DevClass. Retrieved 14 July 2026.
- ↑ "Kotlin multiplatform is stable and production-ready". Hacker News. Archived from the original on 16 February 2024. Retrieved 14 July 2026.
- ↑ Sinha, Nivedita (25 February 2026). "Why Kotlin Multiplatform is a Game-Changer for Startup Teams". Hans India. Retrieved 14 July 2026.
- ↑ "Kotlin Multiplatform Drops Support For Fleet". I Programmer. Retrieved 14 July 2026.
- ↑ "JetBrains launches search portal for Kotlin Multiplatform libraries". InfoWorld. Retrieved 14 July 2026.
- ↑ Herijgers, Laura (24 May 2024). "Kotlin 2.0 shows off faster compilation time: what to expect?". Techzine. Retrieved 14 July 2026.
- ↑ Yener, Murat (23 May 2024). "Google @ KotlinConf 2024: A Look Inside Multiplatform Development with KMP and more- Google Developers Blog". Googl for Developers. Retrieved 14 July 2026.
- ↑ "JVM Languages Report extended interview with Kotlin creator Andrey Breslav". Zeroturnaround.com. 22 April 2013. Archived from the original on 15 January 2019. Retrieved 2 February 2014.
- ↑ "Semicolons". jetbrains.com. Archived from the original on 23 December 2015. Retrieved 8 February 2014.
- ↑ "Types are moving to the right". Medium. 16 July 2020. Archived from the original on 22 May 2023. Retrieved 6 November 2021.
- ↑ "Roman Elizarov is the new Project Lead for Kotlin". The Kotlin Blog. JetBrains. 19 November 2020. Archived from the original on 20 January 2022. Retrieved 7 November 2021.
- ↑ "functions". jetbrains.com. Archived from the original on 23 November 2015. Retrieved 8 February 2014.
- ↑ "What's New in Kotlin 1.3 - Kotlin Programming Language". Kotlin. Archived from the original on 22 August 2023. Retrieved 4 April 2020.
- ↑ "Design by Contract (DbC) design considerations". Kotlin Discussions. 16 August 2012. Archived from the original on 5 April 2023. Retrieved 4 April 2020.
Implement the full semantics of Eiffel DbC and improve upon it.
- ↑ "Kotlin for JavaScript | Kotlin". Kotlin Help. 21 January 2021. Archived from the original on 14 July 2023. Retrieved 19 March 2021.
- ↑ "Kotlin Examples: Learn Kotlin Programming By Example". Archived from the original on 18 November 2021. Retrieved 13 April 2019.
- ↑ "Higher-Order Functions and Lambdas". Kotlin. Jetbrains. Archived from the original on 22 January 2021. Retrieved 19 January 2018.
- ↑ "Kotlin and Android". Android Developers. Archived from the original on 4 October 2023. Retrieved 19 June 2017.
- ↑ Redlich, Michael (30 June 2025). "Java News Roundup: Jakarta EE 11 Released, Agent2Agent Java SDK, Kotlin, WildFly, JobRunr, Maven". InfoQ. Retrieved 14 July 2026.
- ↑ "Using Maven – Kotlin Programming Language". kotlinlang.org. Archived from the original on 3 November 2016. Retrieved 9 May 2017.
- ↑ "Using Ant – Kotlin Programming Language". kotlinlang.org. Archived from the original on 3 November 2016. Retrieved 9 May 2017.
- ↑ T, Karl (10 June 2024), DevCharly/kotlin-ant-dsl, retrieved 14 July 2026 – via GitHub
- ↑ "Using Gradle – Kotlin Programming Language". kotlinlang.org. Archived from the original on 9 November 2016. Retrieved 9 May 2017.
- ↑ Emacs-Kotlin-Mode-Maintainers/kotlin-mode, Emacs-Kotlin-Mode-Maintainers, 8 February 2026, retrieved 14 July 2026 – via GitHub
- ↑ "JetBrains/kotlin-eclipse: Kotlin Plugin for Eclipse". GitHub. Archived from the original on 16 February 2016. Retrieved 11 April 2017.
- ↑ Anderson, Tim (28 August 2024). "JetBrains Workspaces aims for benefits of monorepos without the downside – but only in IntelliJ IDEA". DevClass. Retrieved 14 July 2026.
- ↑ "Kotlin Plugin for JetBrains IDEs". Plugins.jetbrains.com. 31 March 2017. Retrieved 16 October 2025.
- ↑ "What's New in IntelliJ IDEA 2017.1". Jetbrains.com. Archived from the original on 3 October 2023. Retrieved 11 April 2017.
- ↑ "Set up the Android Gradle library plugin for KMP | Kotlin". Android Developers. Retrieved 14 July 2026.
- ↑ "Gradle". Kotlin Help. Archived from the original on 8 April 2024. Retrieved 8 April 2024.
- ↑ "Kotlin Multiplatform Overview". Android Developers. Retrieved 14 June 2025.
- ↑ "Kotlin Multiplatform – Build Cross-Platform Apps". JetBrains. Retrieved 14 June 2025.
- ↑ JetBrains/compose-multiplatform, JetBrains, 14 July 2026, retrieved 14 July 2026
- ↑ Lawson, Loraine (2 May 2025). "10 Cross-Platform Options for Building Native Mobile and Web". The New Stack. Retrieved 14 July 2026.
- ↑ Krill, Paul (14 January 2026). "Compose Multiplatform brings auto-resizing to interop views". InfoWorld. Retrieved 14 July 2026.
- ↑ Panjuta, Denis; Nwokike, Loveth (12 December 2023). "Basic Jetpack Compose Elements". Tiny Android Projects Using Kotlin. Boca Raton: Chapman and Hall/CRC. pp. 233–257. doi:10.1201/9781032622538-9. ISBN 978-1-032-62253-8.
- ↑ "The state of the Octoverse". Archived from the original on 22 March 2019. Retrieved 24 July 2019.
- ↑ "Stack Overflow Developer Survey 2020". Archived from the original on 4 June 2020. Retrieved 28 May 2020.
- ↑ "Octoverse: AI leads Python to top language as the number of global developers surges". GitHub. 29 October 2024. Retrieved 14 July 2026.
- ↑ "Kotlin wins Breakout Project of the Year award at OSCON '19". 18 July 2019. Archived from the original on 17 May 2022. Retrieved 24 July 2019.
- ↑ "Kotlin Case Studies". Kotlin. Retrieved 24 March 2026.
- ↑ King, Caleb (13 November 2023). "Forbes Mobile App Shifts To Kotlin Multiplatform". Forbes. Retrieved 14 July 2026.
- ↑ "Technology 2". Stack Overflow Developer Survey. Retrieved 14 July 2026.
- ↑ "State of Developer Ecosystem Report 2024". JetBrains. Retrieved 14 July 2026.
- ↑ Lardinois, Frederic (17 May 2017). "Google makes Kotlin a first-class language for writing Android apps". techcrunch.com. Archived from the original on 22 May 2017. Retrieved 28 June 2018.
- ↑ "Kotlin programming language: How Google is using it to squash the code bugs that cause most crashes". ZDNet. Archived from the original on 6 April 2023. Retrieved 6 December 2020.
- ↑ "Exploring Ktor: A Modern Networking Framework for Kotlin". DEV Community. 7 January 2026. Retrieved 14 July 2026.
- ↑ "JetBrains' Ktor adds CLI for simpler project creation". InfoWorld. Retrieved 14 July 2026.
- ↑ "Introducing Kotlin support in Spring Framework 5.0". Spring. Pivotal. 4 January 2017. Archived from the original on 23 August 2023. Retrieved 29 September 2020.
- ↑ "The State of Kotlin Support in Spring". JetBrains. 14 August 2020. Archived from the original on 7 June 2023. Retrieved 6 December 2020.
- ↑ "Kotlin Programming - The State of Developer Ecosystem 2020". JetBrains. Archived from the original on 5 April 2023. Retrieved 29 September 2020.
- ↑ "State of Kotlin in 2024". Dice Insights. 30 May 2024. Retrieved 14 July 2026.
- ↑ Yener, Murat (23 May 2024). "Google @ KotlinConf 2024: A Look Inside Multiplatform Development with KMP and more- Google Developers Blog". Google for Developers. Retrieved 14 July 2026.
External links
[edit]- 2011 software
- Free software projects
- High-level programming languages
- Java programming language family
- JVM programming languages
- Object-oriented programming languages
- Programming languages
- Programming languages created in 2011
- Software using the Apache license
- Statically typed programming languages
- Extensible syntax programming languages