Kotlin is a statically typed, general-purpose programming language developed by JetBrains that has built world-class IDEs like IntelliJ IDEA, PhpStorm, Appcode, etc. It was first introduced by JetBrains in 2011. Kotlin is object-oriented language and a better language than Java, but still be fully interoperable with Java code.
Let’s see how to setup Environment for Kotlin using Intellij IDEA and run our first Kotlin code.
- To get started, install a recent version of IntelliJ IDEA. You can download the free Community Edition from JetBrains.
- Once you have installed the Intellij IDEA, create a Kotlin application.
Creating a new project from File -> New -> Project.Then select Kotlin -> JVM | IDEA .
- Name your project and select the SDK version for it. Here we name the project HelloGeeks!.
- Now you have new project HelloGeeks!. Create a new Kotlin file under the source(src) folder and let’s name it is firstapp.kt
- Once the file is created, write the main function. IntelliJ IDEA offers a template to do this in a faster way. Just type main and press tab. Add a line of code to print out ‘Hello Geeks!’.
- Running the application.Now the application is ready to run. The easiest way is to click the green Run button in the sidebar and select Run ‘FirstappKt’. You can run directly by pressing Ctrl + Shift + F10.
- If your program compiles successfully you will see the output in the Run Tool Window.