How to declare an empty array in Java?

To create an empty array in Java, do this: type array[] = new type[size].

Here's how you do it:

int intArray[] = new int[10];
double doubleArray[] = new double[3];
String stringArray[] = new String[5];

// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
System.out.println(java.util.Arrays.toString(intArray));

// [0.0, 0.0, 0.0]
System.out.println(java.util.Arrays.toString(doubleArray));

// [null, null, null, null, null]
System.out.println(java.util.Arrays.toString(stringArray));