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