Kotlin IntelliJ IDEA environment building


Release date:2023-09-21 Update date:2023-10-13 Editor:admin View counts:268

Label:

Kotlin IntelliJ IDEA environment building

Free community version of IntelliJ IDEA download address: https://www.jetbrains.com/idea/download/index.html

After downloading and installing, we can use this tool to create projects. The creation process requires selecting SDK and using Kotlin with JDK 1.6+.

Check the Kotlin (Java) check box in the drop-down menu on the right.

Image0

Next, let’s choose a project name: HelloWorld

Image1

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

Image2

Next, let’s click src folder, creating a Kotlin file, which can be named at will, here we create app.kt

Image3

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

Image4

Now let’s add a line of code to print out "Hello, World!" , let’s do it.

Image5

Next, we can click on the upper left corner of the editor. kotlin icon and select Run ‘AppKt’ to run the code:

Image6

After running successfully, you can run it in the window Run , you can see the results in.

Image7

So the first Kotlin code is running.

Powered by TorCMS (https://github.com/bukun/TorCMS).