how to declare and initialize array in java code example Example: set array length java int[] num = new int[5];