November 2018
Intermediate to advanced
388 pages
9h 5m
English
Now that we have JDK and the Kotlin compiler set up, let's try writing our first program in Kotlin and learn a few different ways to compile and run it.
Let's consider the HelloWorld.kt program, which just prints the hello message and the first argument passed to it:
fun main(args:Array<String>){ println("Hello${args[0]}")}
There are different ways to compile and run Kotlin code:
kotlinc HelloWorld.kt -include-runtime -d HelloWorld.jar
We pass the class name and include the runtime and the name of the JAR as command-line arguments.
Read now
Unlock full access