Default value in fun main


#1

Are default values allowed in main method ? I'm getting an ArrayIndexOutOfBoundsException if I use it like this:

fun main(args: Array<String> = array("TEST")){   println(args[0]) }


#2

Default arguments are allowed, but your main() is executed by the JVM that knows nothing about default arguments, so doesn't use them. (If you call that same method rom your Kotlin code, it will be fine.)