To create a list of strings in Kotlin, you can use the listOf
function to initialize a list with string elements.
In this example,
listOf
function to create a list named stringList
with string elements.listOf
function.fun main() {
val stringList = listOf("Apple", "Banana", "Cherry")
println(stringList)
}
[Apple, Banana, Cherry]
In this tutorial, we learned How to create a List of Strings in Kotlin language with well detailed examples.