Kotlin & Android Intro Course / Chapter 1 — Getting Started with Kotlin (lessons 1–7) / Lesson 1

What Is Kotlin? (Compare with Java)

Time needed: about 3 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

Why Kotlin Is at the Center of Android

Google announced Android development as Kotlin-first in 2019, and today Jetpack Compose, the framework for building screens, assumes you write in Kotlin too.

The first half of this course (lessons 1-14) has you pick up Kotlin as a language, and the second half (lessons 15-50) takes you through building and publishing an Android app.

Let's start by writing a class in Java that just holds a name and an age.

JavaUser.java (excerpt)

public final class JavaUser { private final String name; private final int age; public JavaUser(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public int getAge() { return age; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof JavaUser)) return false; JavaUser other = (JavaUser) o; return age == other.age && Objects.equals(name, other.name); } @Override public int hashCode() { return Objects.hash(name, age); } @Override public String toString() { return "JavaUser(name=" + name + ", age=" + age + ")"; } }

With data class, It's One Line

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.