Q. What is the index of the last element in an array of length n?

A
n
B
n+1
C
n-1
Solution:

Arrays in Java are zero-indexed, meaning the first element is at index 0. For an array of length n, the indices range from 0 to n-1.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!