Industrial Training




First Program (IDE)


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'.



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



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



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



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



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


fun main(args: Array< String>) {  
    println("Hello World!")  
}  
fun main(args: Array< String>) {  
    println("Hello World!")  
}  

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



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



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





Hi I am Pluto.