 Hi guys, so in this video, we're going to be taking a look at array indexing and how to access items in an array So there are two basic operations. We can perform on arrays The first is data dot length and this returns the number of items in the array and Then the second operation is data i where i is the index and this returns the item at index i of the array Now we know that i equals zero is the first index of the array because we count from zero Therefore data zero is how we access the first item in the array Now if we wanted to access the last item in the array i equals data dot length minus one Is the last index Again because we're counting from zero if we use just data dot length We're going to be out of bounds of the array So to access the final item we use data data dot length minus one So just keeping in mind that the first index of the array is index zero It's easy to see for example That we can access the third item in the array with data two The fourth item in the array with data three And just so on and so on like that But what if we want to work backwards and access say the second to last item in the array Well, we already know that the last item is found at The index data dot length minus one So it follows that the second last item can be accessed at index data data dot length minus one minus one or data data dot length minus two All right, so now let's just pop over to eclipse so that we can take a look at how this all works using an example array All right, so you can see here. I have an array Containing eight items, so let's go ahead and try to access some of the items in this array So if I want if I type this print statement So if I access Data index zero, obviously if we go ahead and run that that's going to print out the first item in the array now if I Change that zero to a three just before I run it. Have a quick think about what you think it's going to print out All right, I'll go ahead and run that and It's printed out 48 and you can see that the If we start at index zero, we've got zero one two three the item at index three is 48 Now obviously if we want to go ahead and print out the last item in the array We can use what we did earlier and we can print out The item at index data dot length minus one All right, we'll run that and Yep, six. That's the last item in the array Now what if I change that to? We'll say data dot length minus five So again, just have a quick Think about what that's going to print out and We'll go ahead and run this and it's printed out 48 and you can see here if The item at data dot length minus one is six. We're just going to move to the left Once for each further count. So we've got minus one minus two minus three minus four So the item at data dot length minus five is 48 All right, so that is pretty much it for this video. That was just a short introduction To array indexing and accessing items in an array And in the next video in this series, we're going to be looking at how to traverse an array So thank you for watching. I hope you found this helpful and have a great day. Bye