Kotlin Course

Introduction to Kotlin

A self-study guide for Python 3 compiled from the materials on this site. Primarily intended for those who want to learn the Python programming language from scratch.

What is Kotlin?

Kotlin is a modern, statically-typed programming language developed by JetBrains. It runs on the Java Virtual Machine (JVM) and is fully interoperable with Java. Since 2019, Google officially recommends Kotlin as the preferred language for Android development.

Where is Kotlin used?

  • Android — The #1 language for Android app development
  • Server-side — Ktor, Spring Boot, Vert.x
  • Multiplatform — Share code between iOS, Android, Web
  • Data Science — Kotlin for Apache Spark
  • Desktop — Compose Multiplatform

Your first Kotlin program

fun main() {
    println("Hello, World!")
}

In Kotlin, the main() function is the entry point. println() prints a line to the console.

Why learn Kotlin?

  • 🤖 Official Android development language
  • ✨ Much more concise than Java (up to 40% less code)
  • 🛡️ Null-safety built into the type system
  • ☕ 100% interoperable with existing Java code

Kotlin vs Java

// Java: Person person = new Person("Alice", 25);
// Kotlin:
val person = Person("Alice", 25)

// Java: System.out.println("Hello");
// Kotlin:
println("Hello")