Kotlin allows us to define an array with an explicit type. We can create an array of integers, or characters, for example, using the intArrayOf and charArrayOf keywords:
var numbers = intArrayOf(1, 2, 3)
var chars = charArrayOf('a', 'b', 'c')
Remember that when we declare an array explicitly, we cannot assign a value other than the specified one. We also can't assign an array of a different type. In the preceding integer type array, we can't add a character value or a double value:
var numbers = intArrayOf(1, 2, 3, 4.0, 5.0)
In this case, the compiler will throw an expected type error.