

The get() method takes a single parameter-the index of the element and returns the value of the item at that index. The get() and set() functions are said to be member functions. Therefore, we can access the data of a class object via its member functions. Now, let’s see how to access and modify them.Īs you know, an array in Kotlin is basically a class. So far, we have seen how to create and initialize an array in Kotlin. Other factory methods available for creating arrays: These classes do not extend the Array class however, they implement the same methods and properties.įor example, the factory method to create an integer array is: ISRO CS Syllabus for Scientist/Engineer ExamĪpart from these, Kotlin also has some built-in factory methods to create arrays of primitive data types, such as byteArray, intArray, shortArray, etc.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.


DevOps Engineering - Planning to Production.Python Backend Development with Django(Live).Android App Development with Kotlin(Live).Full Stack Development with React & Node JS(Live).Java Programming - Beginner to Advanced.Data Structure & Algorithm-Self Paced(C++/JAVA).Data Structures & Algorithms in JavaScript.Data Structure & Algorithm Classes (Live).
