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.
- Kotlin Environment setup for Command Line
- Kotlin Data Types
- Hello World program in Kotlin
- Kotlin | Retrieve Collection Parts
- Destructuring Declarations in Kotlin
- DatePicker in Kotlin
- Kotlin labeled continue
- Introduction to Kotlin
- Kotlin Type Conversion
- Kotlin Exception Handling | try, catch, throw and finally
- Kotlin if-else expression
- Kotlin constructor
- Kotlin Nested class and Inner class
- Kotlin Variables
- Kotlin Operators
- Kotlin Standard Input/Output
- Kotlin Expression, Statement and Block
- Kotlin when expression
- Kotlin for loop
- Kotlin while loop
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.