Kotlin vs Java
A modern, null-safe language that runs everywhere Java does, compared against the mature, battle-tested language it interoperates with completely.
2 min read
Kotlin isn't a replacement language competing with Java from the outside — it runs on the same Java Virtual Machine, compiles to the same bytecode, and can call Java code (and be called by Java code) in the same project with essentially no friction. The comparison is really about how much of Java's ceremony you still want to write by hand.
Null safety is the headline difference
Java's NullPointerException is famous enough to have its own nickname ("the billion-dollar mistake," coined by the inventor of null itself). Kotlin bakes nullability into its type system — a type is either nullable (String?) or not (String), and the compiler refuses to let a possibly-null value flow into a spot that assumes it isn't, without you handling that case explicitly.
// Kotlin — nullability is part of the type, checked at compile time
fun greet(name: String?) {
println("Hello, ${name?.uppercase() ?: "stranger"}")
}// Java — nullability isn't tracked by the type system; this compiles
// fine and can throw a NullPointerException at runtime
void greet(String name) {
System.out.println("Hello, " + name.toUpperCase());
}Conciseness
Kotlin cuts a lot of Java's boilerplate: data classes generate equals, hashCode, and toString for you, single-expression functions skip the braces-and-return ceremony, and type inference means you rarely write a type twice. Modern Java (records, var, pattern matching in recent versions) has narrowed this gap somewhat, but Kotlin still reads noticeably tighter for the same logic.
Where each one dominates
Google made Kotlin Android's officially preferred language in 2019, and most new Android code today is written in Kotlin — Jetpack Compose, Android's modern UI toolkit, is Kotlin-first. Java's stronghold is everywhere else on the JVM: enterprise backends built on Spring, huge existing codebases that would be expensive to rewrite, and a job market that, in raw numbers, is still larger than Kotlin's.
Which should you learn first
Learn Kotlin first if you're starting fresh, especially for Android — you'll write less code, get compile-time null safety, and Compose assumes Kotlin idioms throughout. Learn Java if you're joining a team with an existing Java codebase, or want the widest possible enterprise-backend job market — and know that the two are close enough that learning one makes the other much faster to pick up later, since they share the same runtime, tooling, and most core concepts.
See What is Java? for how the JVM and Java's object model work.