It is possible to have more than one type of data in an arrayOf, a ListOf or an arrayListOf Or is it not possible to have Int and String data, for example, in the same Array?
It is possible to have more than one type of data in an arrayOf, a ListOf or an arrayListOf Or is it not possible to have Int and String data, for example, in the same Array?
If possible, you could create an Any List and instantiate it as follows:
val myList = mutableListOf<Any>()
And you would add objects to it in the following way.
myList.add("string")
myList.add(MyObject(null, null))
Try it, and let me know. Greetings.
Yes you can, you must use arrayOf () to generate an array with mixed values :)
val myArray = arrayOf(4, 5, 7, "3", "Chike", false).
Doc. link