In Java, you can initialize an array either by specifying the size and then filling it, or by directly filling it with elements at the time of declaration. For example, int[] myArray = new int[10]; initializes an array with space for 10 integers, whereas int[] myArray = {1, 2, 3}; initializes and fills the array at the same time​​.