Lessons

Java tutorial

Java Arrays

An array stores several values of the same type under one name. Indexes start at 0. The length field tells you how many slots the array has, and it is not a method call.

Example

Edit the code and run it again. This runner stays in your browser and covers the syntax used in these lessons.

Output

Run the example to see output here.

What this code does

The array holds three strings. Index 0 is the first one, Syntax. length reports that there are three slots.