KnowledgeBoat Logo
|

Computer Applications

What is meant by index of an element ? How are indices numbered in JAVA ?

Java Arrays

3 Likes

Answer

Each element in an array is referred to by their subscript or index. The index of an element refers to the position of an element in the array. In Java, the indices start from 0 and go on till size - 1.

For example,

int arr[] = {3, 6, 8};

In the array arr[], arr[0] = 3, arr[1] = 6 and arr[2] = 8.

Answered By

3 Likes


Related Questions