Arrays

Arrays in Java, like Python lists, Javascript arrays, and C arrays, store ordered values. Java arrays cannot be resized without creating a new array and making a copy.

Java arrays, like C arrays, are more limited than their counterparts in Python or Javascript. Java arrays cannot be resized once created, and you must declare the type of the variables that the array will store in advance. The ArrayList class is more flexible, and a frequent alternative to arrays, but first let’s see how to use arrays.

An example of using arrays:

Get hands-on with 1400+ tech skills courses.