Learn Kotlin: Introduction

A ship heading to Kotlin Island — Photo by Egor on Unsplash

Kotlin was created back in 2010 by JetBrains and named after an island located near their headquarter in St. Petersburg.

About seven years later — in 2017 — Google announces their support for Kotlin on Android Development. Two years after that, Google announces Android Development will be increasingly Kotlin first.

Now that you know a little bit of the Kotlin background and that Google puts priority on Kotlin instead of C++ or Java (which are also supported for Native Android Development), you might ask :

What’s so good about Kotlin then?

Or maybe

I’m already comfortable working with Java. Why should I bother learning Kotlin?

Well, let’s move on from “the what” and talk about “the why”. Shall we?

Why Kotlin.

Three words : concise, safe, and interoperable.


Kotlin is extremely concise compared to Java. If you are a Java developer, this is definitely something that you will notice when you first look at Kotlin code. For example let’s see a sample POJO class in Kotlin.

Sample POJO class

And that’s it, you only need to write a single line of code to create a POJO class. All the getters and setters is already available to use.

Want to create a singleton class? Easy peasy. In Kotlin, singleton is declared as object.

Sample singleton class

Kotlin get rid of boilerplates and let you just write more concise code.


Kotlin just won’t let you fall into the billion dollar mistake AKA Null Pointer Exception (NPE). Kotlin checks for null pointers in compile time and prevents you from running it. These are some examples on how Kotlin protect you from NPE :

You will get compilation error when you assign null to a non nullable type variable.

null can not be assigned to a non-nullable variable

You can declare a variable as a nullable. However, Kotlin protects you from mistakenly operating on nullable types since it will potentially throws NPE.

Kotlin won’t let you mistakenly operating nullable variables


You can use any existing library on the JVM (Java Virtual Machine), as there’s 100% compatibility, including SAM support. Target either the JVM or JavaScript. Write code in Kotlin and decide where you want to deploy to.

- kotlinlang.org

If you are not really sure what that means, just know that Kotlin can run on multiple platform mobile, server-side, web frontend, and of course Android.

So now you have learned about the what, when, and why of Kotlin. In the next article we will write and run our first code in Kotlin.

That’s it! I hope you guys got some value out of this article and if you did please leave a comment below, it means a lot to me. I’m open to any suggestion. Thank you for reading.

— Learn Kotlin Series —

  1. Learn Kotlin: Introduction (this article)
  2. Learn Kotlin: Hello World!
  3. Learn Kotlin: Variables
  4. Learn Kotlin: Data Types
  5. Learn Kotlin: Basic Operators
  6. Learn Kotlin: Functions




Android Developer. Currently residing in Jambi, Indonesia. https://romnan.my.id

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Ruby Multi Threading With Pool Size

Programming Poster Now Available

Basic Looping in Python

How To Bridge Tokens Using AnySwap — Boba Network Edition

How to use GoReleaser with Cloud Native Storage

Code Coverage

Streaming Consciousness: It’s time for more EvOps

A Better Calendly Embed

A calendar hanging on a wall

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Deddy Romnan Rumapea

Deddy Romnan Rumapea

Android Developer. Currently residing in Jambi, Indonesia. https://romnan.my.id

More from Medium

Get picked image actual path Android 11,12

How to force turned on the GPU acceleration of Android Webview

How to Observe Network Connection Status

Android Beginner’s Essential Prerequisites