223k views
0 votes
An array is stored in contiguous memory locations. You access the individual array value by using the array name followed by the index location. In other words, here is the array:

42 27 36 94 12 44 18
1. If you want to access the third value (36), you would use numbers[2]
O True
O False

User Gausie
by
6.0k points

1 Answer

4 votes

Answer:

True

Step-by-step explanation:

Indexing in arrays start at zero, so the last element of an array with n number of elements will have the index n-1.

Lets create a simple java application that will print the elements at different indexes of this given array

public class ANot {

public static void main(String[] args) {

int [] numbers = {42,27,36,94,12,44,18};

System.out.println("Element at index 0 is "+numbers[0]);

System.out.println("Element at index 1 is "+numbers[1]);

System.out.println("Element at index 2 is "+numbers[2]);

}

}

The output of this code is:

Element at index 0 is 42

Element at index 1 is 27

Element at index 2 is 36

User EducateYourself
by
6.0k points