# Could someone explain how to solve to this problem?

kenny gill

Ranch Hand

Posts: 54

kenny gill

Ranch Hand

Posts: 54

posted 3 years ago

- 0

Java arrays start at index 0, so in your example A[0] == 1

A.length returns the true length, in this case 4, so you must subtract 1 to get the last entry.

TIP: Be careful if length == 0, since you will then try to index A[-1] which will fail.

WP

A.length returns the true length, in this case 4, so you must subtract 1 to get the last entry.

TIP: Be careful if length == 0, since you will then try to index A[-1] which will fail.

WP

posted 3 years ago

- 0

To learn what exactly arrays are and how they work, see Arrays in Oracle's Java Tutorials.

I agree. Here's the link: http://aspose.com/file-tools |