Computer Applications

A single dimensional array contains 37 elements. Which of the following represents the index of its second-to-last element.

Java Arrays

3 Likes

Answer

35

Reason — In Java, arrays use zero-based indexing. For an array with 37 elements, the indices range from 0 to 36:

  • The last element is at index 36.
  • The second-to-last element is at index 35 (36 - 1).

Answered By

3 Likes


Related Questions