Kotlin is a general-purpose language from JetBrains, open source since 2011 and stable for production on JVM, JS, and Native backends. Google endorsed it for Android in 2017; Spring and Ktor use it on servers.
Core characteristics
- Static typing with inference —
val count = 10infers Int; types checked at compile time - Null safety — nullable types use
?; the compiler rejects many NPE-prone calls - Concise syntax — data classes, properties, and expression-oriented control flow
- Coroutines — structured concurrency without callback pyramids (full library on Gradle projects)
Typical JVM build-run flow (local)
- Write
main.ktwithfun main() kotlinc main.kt -include-runtime -d app.jar && java -jar app.jaror use Gradle- Deploy JVM bytecode alongside existing Java libraries
Important interview questions and answers
- Q: Is Kotlin garbage collected on JVM?
A: Yes—same JVM GC as Java; Kotlin adds value types on Native but JVM Kotlin uses heap objects like Java. - Q: Who uses Kotlin in production?
A: Android apps, Spring Boot services, Gradle plugins, multiplatform shared modules (KMP).
Self-check
- What file extension do Kotlin sources use?
- Name one major platform where Kotlin is the default language.
Tip: Kotlin source uses .kt files compiled to JVM bytecode—think Android, Spring, and Gradle plugins.
Interview prep
- Is Kotlin garbage collected on JVM?
Yes—same JVM GC as Java; Kotlin/JVM uses heap objects like Java.
- Who uses Kotlin?
Android, Spring Boot, Ktor, Gradle plugins, and Kotlin Multiplatform shared modules.