KtKotlin · Lesson 1 of 8
Hello, Kotlin
Kotlin's pitch in one file: everything Java does, in half the lines. main doesn't need a class, printing doesn't need System.out, and semicolons are optional.
Types are inferred: val name = "Ada" is a String without saying so. You can be explicit — val name: String = "Ada" — and must be when there's nothing to infer from. Prefer val everywhere; reach for var only when reassignment is genuinely needed.
◆ Note
Kotlin compiles to JVM bytecode — the same thing Java compiles to. That's why interop is seamless: Kotlin calls Java classes directly and vice versa, and Android's entire Java API is available.
Kotlin compiles to JVM bytecode — the same thing Java compiles to. That's why interop is seamless: Kotlin calls Java classes directly and vice versa, and Android's entire Java API is available.