java how to initialize a array code example Example: initialize an array in java int[] array=new int[5]; int[] array2=new int[]{1,2};