Sunday, April 12, 2020

Kotlin Environment setup with Intellij IDEA

IntelliJ IDEA free community version download address: https://www.jetbrains.com/idea/download/index.html
After downloading and installing, we can use the tool to create a project. The SDK needs to be selected during the creation process. Kotlin is used with JDK 1.6+.
Select the Kotlin (Java) check box in the drop-down menu on the right.
Kotlin Environment setup with Intellij IDEA

Next we take a project name: HelloWorld

After the project is created, the file structure is as follows, which is very similar to that of Java.

Next we click on the src folder to create a Kotlin tutorial file, which can be named arbitrarily, here we create app.kt

Next, we write some code in the app.kt file. IntelliJ IDEA provides us with a template to do this quickly, just type main and press Tab.

Now we add a line of code to print out "Hello, World!"

Next, we can run the code by clicking the kotlin icon in the upper left corner of the editor and selecting Run 'AppKt'

After running successfully, you can see the result in the window Run.

No comments:

Post a Comment