Kotlin
Kotlin 2.4 on the JVM: values and null safety, functions and classes, collections, coroutines and Flow, Java interop, testing and back-end services.
16 lessons: 8 free with Pro answers and 8 with a free core.
Examples run with Kotlin 2.4.20.
Who it is for
Android developers and JVM back-end developers who already program in another language, and Java developers who want a fast map of Kotlin before going deep on coroutines, Flow and back-end work.
What you will be able to do
- Install Kotlin 2.4 and a JDK, run programs, scripts and Gradle builds, and read what the compiler reports
- Write Kotlin with values, types, control flow, functions, lambdas and extension functions
- Use nullable types, safe calls, smart casts and platform types to keep null where it belongs
- Model data with classes, objects, interfaces, sealed types, value classes and generics with variance
- Choose and transform collections, sequences and maps by what each operation costs
- Handle errors, resources, files, time, IDs and opt-in APIs safely
- Write structured concurrent code with coroutines, cancellation, supervision, channels and Flow
- Call Java from Kotlin and back, and use DSLs, context parameters and preview features with care
- Test, build and check code with kotlin.test, Kotest, MockK, Gradle and static analysis
- Build back-end services and multiplatform code, and prepare for Android and Kotlin interviews
Revise and practise
- Practice: every exercise and quiz (16 quizzes)
Modules and lessons
What the labels mean
- Free lesson, Pro answers
- the whole lesson is free; the model answers to its interview questions open with a pass
- Free core, Pro depth
- the core of the lesson is free; its in-depth parts open with a pass
- Pro
- opens with a Pro, Premium or Ultimate pass
Minutes are reading time: “9 of 25 min free” means 9 minutes of the lesson are free.
What a pass opens in this track
17 in-depth parts and 40 interview answers. The same pass opens every other track and every Pro tool.
- Module 1
Start here: Kotlin 2.4 on the JVM
What Kotlin is and where it runs, installing Kotlin, a JDK and an editor, first programs with kotlinc and kotlinr, a Gradle project, compiler messages, and scripts.
- What Kotlin is and where it runs Free lesson, Pro answers: 15 minutes
- Install Kotlin, a JDK and an editor Free lesson, Pro answers: 15 minutes
- Your first program with kotlinc and kotlinr Free lesson, Pro answers: 10 minutes
- A Gradle project for Kotlin from scratch Free lesson, Pro answers: 15 minutes
- Read compiler errors, warnings and opt-ins Free lesson, Pro answers: 15 minutes
- Kotlin scripts, the REPL and notebooks Free lesson, Pro answers: 15 minutes
- Module 2
Values, types and control flow
val and var with type inference, numbers and overflow, strings and templates, parsing text, if and when as expressions, loops and ranges, functions, and a map for Java developers.
- val, var and type inference Free lesson, Pro answers: 15 minutes
- Numbers, conversions and overflow Free core, Pro depth: 9 of 25 minutes free
- Strings, characters and string templates Free core, Pro depth: 8 of 20 minutes free
- Parse text and format Indian numbers Free core, Pro depth: 7 of 20 minutes free India-specific
- if and when expressions Free core, Pro depth: 6 of 15 minutes free
- Loops, ranges and labelled jumps Free core, Pro depth: 4 of 10 minutes free
- Module 3
Null safety
Nullable types, safe calls and Elvis, smart casts and safe casts, nulls inside collections and generics, and platform types from Java.
- Nullable types, safe calls and Elvis Free lesson, Pro answers: 10 minutes
- Smart casts, is checks and safe casts Free core, Pro depth: 6 of 15 minutes free
- Nulls inside collections and generics Free core, Pro depth: 4 of 10 minutes free
- Platform types and Java nullability Free core, Pro depth: 6 of 15 minutes free
Official documentation
- Kotlin documentation (JetBrains (kotlinlang.org))
- What's new in Kotlin 2.4.0 (JetBrains (kotlinlang.org))
- Kotlin releases (JetBrains (kotlinlang.org))
- Coroutines guide (JetBrains (kotlinlang.org))