English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Kotlin Introduction Tutorial

Welcome to the Kotlin tutorial! Kotlin is popular on Android. If you want to learn the Kotlin programming language, this is a good starting point.

Our Kotlin tutorial provides a detailed introduction to the Kotlin programming language, its basic knowledge, and examples, to understand basic functional programming statements, object-oriented concepts, file operations, string operations, and more.

Kotlin is a programming language. It can be used to develop modern multi-platform applications suitable for desktops, Android, Web, and more.

Kotlin runs on the Java Virtual Machine like other programming languages: Scala, Groovy, Kawa, and so on.

Kotlin is a statically typed programming language that runs on the Java Virtual Machine (JVM), known as Swift in the Android world, designed and developed by JetBrains and open sourced.

Kotlin can be compiled into Java bytecode and can also be compiled into JavaScript, making it convenient to run on devices without JVM.

At Google I/O 2017in which Google announced Kotlin as the official development language for Android.

My first Kotlin program

Kotlin program files end with .kt, such as: hello.kt, app.kt.

package hello                      //  Optional header
 
fun main(args: Array<String>) {    // Package-level functions, accepting an array of strings as a parameter
   println("Hello World!")         // Semicolons can be omitted
}

Object-oriented

class Greeter(val name: String) {
   fun greet() { 
      println("Hello, $name")
   }
}
 
fun main(args: Array<String>) {
   Greeter("World!").greet()          // Creating an object without the 'new' keyword
}

The history of Kotlin

   to2017year, Kotlin is a relatively new statically typed language developed by JetBrains. Kotlin aims to run on the Java Virtual Machine (JVM). Kotlin solves most of the redundant problems in the Java programming language and also adds new features that can make application development faster and easier.

   There are also other new languages that can run on JVM with new features, but Kotlin stands out compared to other languages in reducing compilation time (compared to the time spent by the Java Compiler). Similarly, Kotlin is concise and clear, while maintaining good compatibility with the existing Java stack. Moreover, Kotlin can be written alongside Java, or we can use IntelliJ IDEA to convert existing Java classes to Kotlin files or classes. All these features make it easy and quick for Java developers to start using Kotlin.

   Although that is the case, the first stable version of Kotlin is 1.0 was released on2016year2month15publishes daily. JetBrains will continue to support Kotlin 1.0 provides backward compatibility. In addition, Google has added Kotlin as the official supported language for Android application development, which is available from Android Studio 3obtained in version .0.

Why Choose Kotlin?

  • Conciseness: Greatly reduce the amount of boilerplate code.

  • Security: Avoid entire class errors such as null pointer exceptions.

  • Interoperability: Make full use of existing libraries of JVM, Android, and browsers.

  • Tool-friendly: Any Java IDE or use command line to build.

IDE for Kotlin Development

You can develop and use applications written in Kotlin language on IntelliJ IDEA, it is recommended to use. Eclipse or any editor can also be used with the compiler to compile from the command line.

Reference Links