Kotlin - Two-Dimensional Arrays Example

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.
packagenet.javaguides.kotlin.examplesimportjava.util.Arraysfunmain(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