Creating our Hello World code

The default position where Gradle searches for Kotlin files is in the src/main/kotlin directory. We'll place our hello.kt file in  the src/main/kotlin/com/packtpub/appendix directory:

package com.packtpub.appendix

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

And now we can compile and run in one go with the following command:

$ ./gradlew

As we defined that our default task is run and our main class is com.packtpub.appendix.HelloKt, just by running ./gradlew we can build and run our peogram.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.197.136