Create, Compile and Run the Hello World Program in Kotlin
A school fair needs a welcome screen at the entrance. Print a greeting first. Seeing the exact words on screen confirms that the saved program ran and sent text to its output.
1. Save the following program as HelloWorld.kt.
Kotlin allows the entry point to be a top-level main function. The source file name does not need to match a class name.
fun main(args: Array<String>) {
println("Hello World")
}
Hello World
2. Build the JAR with kotlinc HelloWorld.kt -include-runtime -d HelloWorld.jar, then run java -jar HelloWorld.jar.
