Kotlin First Program Printing 'HelloWorld'

Let's create a Kotlin first example using IntelliJ IDEA IDE.

Steps to Create First Example

1. Open IntelliJ IDEA and click on Create New Project'.


Kotlin First Program IDE

2. Select Java option, provide project SDK path and mark check on Kotlin/JVM frameworks.


Kotlin First Program IDE 1

3. Provide the project details in new frame and click 'Finish'.


Kotlin First Program IDE 2

4. Create a new Kotlin file to run Kotlin first example. Go to src ->New->Kotlin File/Class.


Kotlin First Program IDE 3

5. Enter the file name 'HelloWorld' and click 'OK'.


Kotlin First Program IDE 4

6. Write the following code in 'HelloWorld.kt' file. Kotlin files and classes are saved with ".kt" extension.

We will discuss the detail of this code later in upcoming tutorial.


Kotlin First Program IDE 5

7. Now we can run this program by right clicking on file and select Run option.


Kotlin First Program IDE 6

8. Finally, we got the output of program on console, displaying 'HelloWorld' message.


Kotlin First Program IDE 7
Next TopicKotlin Variable




Latest Courses