- IntelliJ (IDE)
-
Create a new Kotlin JVM project in IntelliJ:
File->New->Project. On the left, make sureJavais selected, then selectKotlin/JVMunderAdditional Libraries and Framework. PressNext. Skip the next page, then name your project and set where the project is saved. -
Once your project loads, click the dropdown on your project folder. Right click the
srcfolder and selectNew->Kotlin File/Class. Name the fileHelloWorld -
Write a method called
main. The body of the method should printHello Worldonto the console when the program is run. You can run the program by clicking the green triangle next to your method.
Try it yourself before looking at these!
Code
fun main() {
println("Hello World")
}
Console Output
Hello World
Process finished with exit code 0