This Kotlin example shows how to create two-dimensional arrays in Kotlin.
Kotlin - Two-Dimensional Arrays Example
The example creates a two-dimensional array by nesting intArrayOf() function calls into thearrayOf()function.package net.javaguides.kotlin.examples
import java.util.Arrays
fun main(args: Array < String > ) {
val array = arrayOf(intArrayOf(1, 2),
intArrayOf(3, 4),
intArrayOf(5, 6, 7))
println(Arrays.deepToString(array))
}
Output:
[[1, 2], [3, 4], [5, 6, 7]]
Comments
Post a Comment