Introduction to Kotlin
Kotlin is a statically-typed language that runs on the same JVM Java does, and is Google's preferred language for Android development.
Example: a minimal Kotlin program
fun main() {
println("Hello, world!")
}
Hello, world!
Kotlin can call any existing Java code directly, but with more concise
syntax — fun main() needs no wrapping class the way Java's
public class Main { public static void main(...) } does.
Kotlin also catches a lot of "null" errors at compile time instead of at
runtime: a variable's type has to explicitly allow null
(written String? instead of just String) before
it's even permitted to hold one, which prevents an entire, very common
category of Java crash from happening in the first place.
fun main() {
println("Hello, world!")
}
Hello, world!