Introduction to Kotlin
This article is a full translation to English from an article written by my friend in Japanese. This is the original article.
What is Kotlin?
Kotlin officially became a language for Android developing at the Google I/O 2017.
Kotlin is a object-oriented language developed by JetBrain, who also made the java programming software called intelliJ. https://kotlinlang.org/
It is 100% compatible and able to use with java and Android Projects.
That means you can use part Kotlin, part Java in your codes. For swift users, it has many similar writings, so it is probably easier to understand.
What is So Great about Kotlin?
*This will all be discussed on the 2nd chapter in detail!
- null safe
- type interface
- can use high-order function
- easy to read
- You can use it with java
- cheaper learning cost
- coding speed is faster
- FUN WRITING
Which can let you notice bugs quickly. You can use Kotlin for Javascript as well!
How to use Kotlin?
1. Using IntelliJ (it supports Kotlin!)
If you install the newest intelliJ, Kotlin will be supported, but for older versions, you have to download a plugin that understands Kotlin.
To install the plugin (for older intelliJ), you need to go to
Preferences > Plugin > Install JetBrainsPlugin... > Kotlin

2. Use Try Kotlin on web
You can test sample codes on the online web Kotlin tester.
https://try.kotlinlang.org/#/Examples/Hello,%20world!/Simplest%20version/Simplest%20version.kt
3. Use Android Studio
The same story with IntelliJ. The newest version does not need a Kotlin plugin, because it supports the language
But for older Android Studio versions, you need to install a plugin.
If you are using libraries that do automatic generating, you also need to configure Kotlin in project (below)
Tools > Kotlin > Configure Kotlin in Project

4. One Button Conversion from java -> Kotlin!!
There is a magic button in IntelliJ & Android Studio that changes your java codes into Kotlin
Code > Convert Java File to Kotlin File

If you have a java code like the left one, it will turn right away into the codes on the right


Start a Project!
Don’t forget to choose Kotlin when starting a new project
New Project > Kotlin > Kotlin JVM

And when making a new class, don’t forget to make a Kotlin class

This ends Chapter 1 /2 of Intro to Kotlin!!
Part two will be introduced shortly!
