Answers for "how to declare string array in kotlin"

3

how to declare string array in kotlin

//String[] in Java equivalent Array<String> in Kotlin 
//eg.
var array1 : Array<String?> = emptyArray()
var array2: Array<String?> = arrayOfNulls(4)
var array3: Array<String> = arrayOf("Mashroom", "Kitkat", "Oreo", "Lolipop")
Posted by: Guest on January-04-2021
1

how to make array in kotlin

val num = arrayOf(1, 2, 3, 4)   //implicit type declaration
val num = arrayOf<Int>(1, 2, 3) //explicit type declaration
Posted by: Guest on June-04-2020

Code answers related to "how to declare string array in kotlin"

Browse Popular Code Answers by Language