Arrays

Collections of a single type. Try using collections before arrays.

Creating Arrays

Defining the values:

int[] integers = { 1, 2, 3 };

Defining size:

int[] integers = int[3];

Editing Arrays

integers[0] = 10;

Arrays as Variable Arguments

Variable arguments are handled as arrays

public void someMethod(final Integer... values);
someClass.someMethod(1, 2, 3);

Utilities Class

The JDK offers the Arrays static class, with several helpful methods.

More Information

Last updated