Kotlin Tutorial

Welcome to Kotlin Tutorial! Kotlin has become popular with Android. If you would like to learn Kotlin programming language, this is a good start.

This Kotlin Tutorial provides a detailed introduction to Kotlin programming language, its basics, and examples to understand basic functional programming statements, object-oriented concepts, file operations, string operations, etc.

What is Kotlin?

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

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

Why Kotlin has become popular?

If the word Kotlin has been buzzing around for quite some time, all the credit goes to Google Android, because Google had brought this language to lime light. Once Google Android declared that Kotlin will be one of the officially supported language for Android App development, Kotlin’s popularity had surged. And Kotlin has become popular with the existing Android community and also the emerging.

Kotlin programming language can be used to develop Desktop Applications and Android Applications with ease. These tutorials have been designed to present you the basics and new idiomatic approach.

Kotlin Tutorial

A little introduction to Kotlin’s history

Kotlin is relatively a new statically-typed language by 2017, developed by JetBrains. Kotlin is targeted to run on the Java Virtual Machine (JVM). Kotlin addresses most of the redundancies present in Java programming language, and also new features have been added that could make application development faster and easier.

There are other new languages with new features that could run on JVM, but Kotlin excels in the reduced compile time (comparable to the time taken by Java Compiler) when compared to other languages.

Also, Kotlin is concise and expressive while maintaining a good compatibility with existing Java stack. And Kotlin could be written alongside Java or we could convert existing Java classes to Kotlin files or classes using IntelliJ IDEA. All these features make it easy for a Java developer to get started with Kotlin quickly.

That being said, the first stable version of Kotlin, Kotlin 1.0 has been released on 15th, Feb 2016. JetBrains would provide backward compatibility for Kotlin 1.0 for a long time. Also, Google added Kotlin as an officially supported language for Android Application development, which is available from Android Studio 3.0.

Prerequisites for this Kotlin Tutorial

Understanding of Java Basics would help a lot in learning Kotlin quickly. However this Kotlin Tutorial is designed to address both beginners and advanced developers.

IDE for Kotlin Development

Applications using Kotlin Language could be developed on IntelliJ IDEA and is recommended. Eclipse or any editor could also be used along with a compiler to compile from the command line.

Android Studio

Android Applications could be developed using Kotlin from Android Studio version 3.0.

Refer Kotlin Android Tutorial to develop Android Applications using Kotlin programming language.

Kotlin Tutorials Index

The following tutorials help you get started with Kotlin development.

Kotlin Environment Setup

First and foremost thing to do is, setting up your environment to work with Kotlin.

Having set up our environment and a peek of Kotlin program, let us understand the basics of Kotlin.

Kotlin Conditional Statements

Conditional Statements are those which can execute a block of code based on the result of a condition. The following tutorials cover the basic conditional statements in Kotlin, followed by some of typically scenarios with conditional statements.

Kotlin Loops

Kotlin loop statements are used to execute a block of code multiple times based on a condition. In the following tutorials, we start with an introduction to loops in Kotlin programming. Then we dive deep into each of the looping statements in Kotlin, and some of typical scenarios where these looping statements are used.

Kotlin Exception Handling

Exception Handling is a must known tool to every developer for any programming language. The following tutorials start with a basic try-catch statement, and then about explicitly throwing an exception, or writing our own Exceptions, etc.

Kotlin Object Oriented Concepts

Kotlin supports object oriented programming. The following tutorials get us introduced to different object oriented concepts, and about each of them in detail.

Kotlin Array

An array is an ordered collection of similar type of elements. In the following tutorials, we start with an introductory tutorial to basics of Array in Kotlin, and then some of the mostly used function of Array class in Kotlin, followed by regularly used use-cases.

Kotlin Basics

  • Kotlin main function
  • Kotlin Extension Functions – Kotlin extension functions actually help in extending the functionality of a class without actually inheriting the class.
  • Kotlin Null Safety – Null Safety can used to eliminate the risk of NullPointerException in real time.
  • Kotlin Enum Classes – Kotlin Tutorial about how Enum class allows a variable to hold a value only from a set of predefined constants.
  • Kotlin use function – In Kotlin, use is a keyword, used to execute a given block function on this resource.
  • Kotlin Ranges – Kotlin Tutorial on how to express a series of numbers defined as a range and different scenarios where ranges can be used.

Kotlin String Operations

It is very necessary to know about String Operations in programming applications. Following topics take you through some of the String Operations that are commonly used.

Kotlin File Operations

If our application requires working with files which need operations like reading, writing, modifying and appending content in a file or moving files from one location to another and such, following are the tutorials that help you with file operations.

Kotlin Interfacing to Database

If our Kotlin Application needs interfacing to a database, following topics explain how to connect to different databases.

Kotlin Error Handling

This section of tutorials focuses on how to handle most frequently occurring errors during programming in Kotlin.

Interview Questions & Answers

Find the mostly asked Interview Questions and respective answers for Kotlin programming.

Conclusion

By following these Kotlin Tutorials, you would definitely learn Kotlin basics and tools required to work with Desktop applications and Android Applications.