How do you access elements in an array?

  • By specifying the element's value.
  • By using a loop to iterate through each element.
  • By using the 'elementAt()' function.
  • By using the array's index within square brackets.
Elements in an array are accessed by using the array's index within square brackets. The index indicates the position of the element in the array, starting from 0 for the first element.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *