What is Kotlin?

Kotlin is a statically typed programming language that runs on the JVM (or Java Virtual Machine). It can be operated on multiple platforms and is compatible with Java, Android, JavaScript, as well as native applications. The language is developed by the team at JetBrains. JetBrains is committed to the project, has a large and highly competent team working on it.

Is Kotlin free?

Yes. Kotlin is free, has been free and will remain free. It is developed under the Apache 2.0 license and the source code is available on GitHub.

What is a statically typed programming language?

A language is statically typed if the type of a variable is known at compile time. For some languages this means that you as the programmer must specify what type each variable is; other languages offer some form of type inference, the capability of the type system to deduce the type of a variable.

The main advantage here is that all kinds of checking can be done by the compiler, and therefore a lot of trivial bugs are caught at a very early stage.

What can it be used for?

It can be used for any kind of development, be it server-side, client-side web and Android. With Kotlin/Native currently in the works, support for other platforms such as embedded systems, macOS and iOS is coming. People are using Kotlin for mobile and server-side applications, client-side with JavaScript or JavaFX, and data science, just to name a few possibilities.

Is the language hard?

Kotlin is inspired by existing languages such as Java, C#, and JavaScript. The language is easy to learn and people can easily jump on board, reading and writing code in a matter of days. Learning idiomatic Kotlin and using some more of its advanced features can take a little longer, but overall it is not a complicated language. The syntax is lean and intuitive. Kotlin seems to be simpler and cleaner than Java. It removes a lot of redundancies in code from Java.

Is it an object-oriented or functional language?

The language has both object-oriented and functional constructs. You can use it in both object-oriented and functional programming styles, or mix elements of the two.

Can I use both Java files and Kotlin files in the same project?

Yes. You can mix it with Java code. It is full interoperable with Java.

What are the features you think are there in Kotlin but not in Java?

Kotlin has quite a number of features that Java doesn’t. To name some of them, they are

  • Extension Functions
  • Null Safety
  • Smart Casts
  • Range Expressions
  • Operator Overloading
  • Data Classes
  • Companion Objects
  • Coroutines

Why did Android make Kotlin a first-class supported language?

Kotlin is an Android-compatible language that is concise, expressive, and designed to be type- and null-safe. It works with the Java language seamlessly, so it makes it easy for developers who love the Java language to keep using it but also incrementally add Kotlin code and leverage their libraries. Many Android developers have already found that Kotlin makes development faster and more fun, so we want to better support these users. So, there is much to expect from Kotlin in easing out the development efforts and good support in future.

How do I use it with Android Studio?

It is fully supported in Android Studio 3.0 and higher. Previously it was required that you add a plugin, but all new releases of Android Studio ship with these tools built in. You can create new projects using .kt files, convert Java language code to Kotlin, debug code and more without any extra steps. Get started by reading the guide for Android projects.

What is the entry point to a Kotlin program ?

Like most of the other procedural languages, main() function is the entry point to a Kotlin program. An Example for main() function is :

fun main(args: Array<String>)
// main function