Collections Java Tutorial

To reference the components of an array, use an index after the variable name.
For example, the following snippet creates an array of four String objects and initializes its first member.

public class MainClass {
  public static void main(String[] args) {
    String[] names = new String[4];
    names[0] = "Hello World";
  }
}