Ask Question
21 December, 06:59

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

+3
Answers (1)
  1. 21 December, 07:02
    0
    True

    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
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “An array is stored in contiguous memory locations. You access the individual array value by using the array name followed by the index ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers