What you'll learn
Welcome to Kotlin — a modern, concise, and safe language that has become the go-to choice for Android and a favourite far beyond it. This first module builds your mental model: what Kotlin is, why it exists, where it runs, and how to write and run your first program.
By the end you'll be able to:
- Explain what Kotlin is and why developers love it
- Describe where Kotlin runs — the JVM, Android, and beyond
- Understand how Kotlin compiles and runs
- Set up your tools and use the REPL / Playground
- Write, run, and dissect your first Kotlin program
What is Kotlin?
Kotlin is a modern, statically-typed programming language created by JetBrains (the makers of IntelliJ IDEA) and first released in 2016. It was designed to fix the pain points of Java while staying 100% interoperable with it. In 2019, Google made Kotlin its preferred language for Android.
Developers reach for Kotlin because it is:
- Concise — dramatically less boilerplate than Java
- Safe — its type system eliminates most null-pointer errors (Module 3)
- Interoperable — use any Java library, mix Kotlin and Java freely
- Modern & expressive — coroutines, data classes, and more, built in
Java
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}Kotlin
fun main() {
println("Hello, World!")
}Same result, far less ceremony — no class, no public static void, no semicolons. That conciseness is Kotlin's whole point.
Where Kotlin runs
Kotlin is remarkably versatile — the same language targets many platforms. Most commonly it compiles to JVM bytecode (like Java), but it also compiles to native binaries and JavaScript:
Android
The official language for Android — Google recommends Kotlin first.
Backend & Servers
Ktor, Spring Boot, and microservices on the JVM.
Multiplatform
Share code across Android, iOS, web, and desktop.
Anywhere Java runs
100% interoperable with Java and its huge ecosystem.
How Kotlin runs your code
On its most common target, the JVM, Kotlin works just like Java under the hood. The Kotlin compiler (kotlinc) turns your .kt source files into bytecode (.class files), which the Java Virtual Machine executes. This is exactly why Kotlin can use every Java library ever written — they end up as the same bytecode.
Key idea
Getting set up
Getting ready to code takes a few steps:
- Install a JDK (Java Development Kit, 17 or newer) — Kotlin runs on the JVM, so it needs one.
- Install an IDE — IntelliJ IDEA (Kotlin's home, made by the same company) or Android Studio for Android. Both bundle Kotlin.
- Experiment instantly with the online Kotlin Playground — no installation needed — or the REPL:
>>> 2 + 3
res0: kotlin.Int = 5
>>> val name = "Sara"
>>> "Hi, $name"
res2: kotlin.String = Hi, SaraYour first program: Hello, World!
By tradition, the first program prints "Hello, World!". In Kotlin it's beautifully short — press Run:
fun main() {
println("Hello, World!")
}Let's make it greet you by name, using a string template — the $ drops a variable's value straight into the text:
fun main() {
val name = "Sara"
println("Hello, $name!") // string template
}Anatomy of a Kotlin program
That tiny program has a few parts worth naming:
fun— the keyword that declares a functionmain()— the special entry point where every Kotlin program startsprintln(...)— a built-in function that prints a line of text- The curly braces
{ }group the function's body
Notice what's missing compared to Java: no class wrapping main, no public static void, and no semicolons at the end of lines. Kotlin keeps only what's essential.
Note
Recap & quick check
Key takeaways
- Kotlin is a modern, concise, statically-typed language by JetBrains — Google's preferred language for Android.
- Kotlin is 100% interoperable with Java because both compile to the same JVM bytecode.
- It targets the JVM, Android, Native, and JS, and enables Kotlin Multiplatform.
- A program starts at fun main(); println() prints text; string templates use $name.
- Kotlin uses braces (not indentation) to group code, and semicolons are optional.
Quick check
1. Who created Kotlin, and what is it best known for?
2. Why can Kotlin use any Java library?
3. Where does a Kotlin program start?
4. How does Kotlin group blocks of code?
5. What does $name do inside a string?
Brilliant — you understand what Kotlin is and you've run your first program. Next up: Module 2 — Variables, Types & Basic Syntax.