January 2018
Intermediate to advanced
434 pages
14h 1m
English
Let's now follow the given steps to create a 2D array in Kotlin:
val array = Array(n, {IntArray(n)})
Here, n represents the dimension of the array. Here, we have used the Array class of Kotlin, which represents an array (specifically, a Java array when targeting the JVM platform). We have initialized the Array object by passing the size and initializer:
public inline constructor(size: Int, init: (Int) -> T)
Array<IntArray>(10 ...
Read now
Unlock full access