Kotlin Tutorial

Welcome to the Kotlin tutorial! Kotlin has become popular on Android. If you want to learn the Kotlin programming language, this is a great place to start.

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

Kotlin is a programming language. It can be used to develop modern multi-platform applications for desktop, Android, web, etc.

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

Kotlin is a statically typed programming language running on the Java virtual machine, known as the Swift of the Android world, designed and developed by JetBrains and open sourced.

Kotlin can be compiled to Java bytecode or to JavaScript, which is convenient to run on devices without a JVM.

At Google I/O 2017, Google announced Kotlin as the official Android development language.

First Kotlin Program Example

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

Minimal Version

package  hello                       // optional header
fun  main(args:  Array<String>)  {     // A package-level visible function that accepts an array of strings as a parameter 
   println("Hello World!")          // The semicolon can be omitted 

Object Oriented Example

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

History of Kotlin

  As of 2017, Kotlin is a relatively new statically typed language developed by JetBrains. The goal of Kotlin is to run on the Java Virtual Machine (JVM). Kotlin solves most of the redundancies that exist in the Java programming language and also adds new features that make application development faster and easier.

  There are other new languages ​​with new features that can run on the JVM, but Kotlin excels in reducing compilation time (compared to the time taken by the Java Compiler) compared to other languages. Again, Kotlin is concise and straightforward, while maintaining good compatibility with existing Java stacks. And Kotlin can be written with Java, or we can use IntelliJ IDEA to convert existing Java classes to Kotlin files or classes. All these features make it easy and fast for Java developers to get started with Kotlin.

 Having said that, the first stable version of Kotlin, Kotlin 1.0, was released on February 15, 2016. JetBrains will provide backward compatibility for Kotlin 1.0 for a long time. 

Additionally, Google added Kotlin as an officially supported language for Android app development, which is available from Android Studio 3.0.

Why choose Kotlin?

  • Concise: Greatly reduces the amount of boilerplate code.
  • Safe: Avoid class-wide bugs like null pointer exceptions.
  • Interoperability: Leverage existing libraries for JVM, Android, and browsers.
  • Tool friendly: Can be built with any Java IDE or using the command line.

IDE for Kotlin development

Applications using Kotlin language can be developed 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 link