ByteBrawl - Arrays - Concepts To Know - Java Basics

Concepts To Know - Arrays

Arrays

An array is another Java type, but it's a little different. It is a list of any type. For example, to hold some strings, you could use an array like this:

You can access the elements of an array using their index, like this:

And, you can set a new value for a specific index of an array using the same syntax:

You can use arrays in the same way with any other type (including classes and other arrays).