Kotlin
A modern, statically-typed language and Google's preferred language for Android.
CurrentintermediateFull course available
Overview
Kotlin is a statically-typed language that runs on the JVM (interoperating fully with existing Java code) and is Google's officially preferred language for native Android development, offering more concise syntax and built-in null safety compared to Java.
- What it is
- A statically-typed language, interoperable with Java, used primarily for native Android development.
- Why it's used
- For more concise syntax than Java, built-in null safety, and full interoperability with the existing Java/Android ecosystem.
- Where it fits
- The current default language for native Android apps, alongside Android's Jetpack libraries.
Core concepts
- Null safety (?, !!)
- Data classes
- Extension functions
- Coroutines (async programming)
Example
A data class auto-generates equality, toString, and copy methods from its properties -- eliminating boilerplate Java requires you to write by hand for the same thing.
data class User(val name: String, val age: Int)
fun greet(user: User) = "Hello, ${user.name}!"Common use cases
- Native Android app development
- JVM-based backend services (as a Java alternative)
Project ideas
- A simple data class modeling a domain object, with a function that formats it for display