A quick-reference guide for Kotlin programming
Kotlin is a modern, statically typed JVM language developed by JetBrains. It is fully interoperable with Java and is the preferred language for Android development. Also used for server-side development.
Platform JVM, Android, JS, Native Paradigm OOP, Functional Typing Static
val — immutable (like Java final)var — mutableval name = "HCL"String? vs Stringname?.length, Elvis: name ?: "default"fun greet(name: String): Stringfun String.shout() = uppercase()val square = { x: Int -> x * x }data class User(val id: Int, val name: String)object Config { ... }suspend fun — suspending functionslaunch — fire and forget coroutineasync / await — concurrent with resultFlow — cold asynchronous streamsCoroutineScope| Category | Framework / Library |
|---|---|
| Android | Android SDK, Jetpack Compose |
| Server-side | Ktor, Spring Boot |
| Testing | JUnit5, Kotest, MockK |
| DI | Koin, Hilt (Android) |
| Build | Gradle (Kotlin DSL) |
!! vs ?.let, run, apply, also,
with