Kotlin interviews focus on null safety, collection operations, coroutines, and whether you understand object, companion object, and sealed classes. Android roles add lifecycle and ViewModel. Be ready to rewrite a Java POJO as a data class and to explain ?. vs ?: vs !!.
This Kotlin cheat sheet is written for people searching for a fast, accurate reference: students, junior developers, and teams shipping production software. Pin it, copy the snippets, and come back when syntax slips.
Quick reference
- Null:
?.safe call,?:elvis,!!crash.lateinitvsby lazy. - data class:
equals/hashCode/copy/componentNfor constructor properties. - sealed: Restricted type hierarchy.
whenis exhaustive without else if all subtypes are known. - object: Singleton.
companion objectfor “static” members on a class. - inline / reified:
inline fun <reified T>for type checks that Java erases. - Scope:
let,run,apply,also,with— know one example each, not all trivia. - Coroutine:
launchvsasync, structured concurrency, Main vs IO. - Equality:
==callsequals.===is identity. Data classes usually want==.
Copy-paste examples
Exhaustive when on a sealed result
Interviewers like this because it shows you stopped using boolean flags for success/error.
sealed class Result<out T> {
data class Ok<T>(val value: T) : Result<T>()
data class Err(val message: String) : Result<Nothing>()
}
fun <T> Result<T>.unwrap(): T = when (this) {
is Result.Ok -> value
is Result.Err -> error(message)
}Common mistakes
- Explaining
!!as “the non-null operator” without saying it throws. - Confusing
object(singleton) withcompanion object. - Saying Kotlin is interpreted or is a markup language.
- No example of a coroutine dispatcher on Android.
FAQ
- What is a platform type? A Java type Kotlin does not know is null or not (
String!). Treat it as nullable at the boundary.
- val vs const val?
const valis a compile-time constant (primitive/String) on objects.valis a runtime read-only property.
- How does Kotlin compile? To JVM bytecode (Android/backend), or to JS/Native for other targets. Android interviews mean JVM/ART.
Related Kotlin cheat sheets
Build with this stack
When a cheat sheet is not enough — you need a production app, a student FYP, or a custom dashboard — ArpaNeuro builds mobile app development and also sells ready-made source code. Request a quote and tell us the stack.
Browse software development services or the source code marketplace if you want a working codebase instead of starting from a blank file.