comparisons succeed declaring arrays one way to declare and initialize an array is as followselement_type[array_name {init_val_ ,init_val_ ,init_val_n- }the element_type can be any java base type or class nameand array_name can be any value java identifier the initial values must be of the same type as the array for exampleconsider the following declaration of an array that is initialized to contain the first ten prime numbersint[primes { }in addition to creating an array and defining all its initial values when we declare itwe can declare an array variable without initializing it the form of this declaration is as followselement_type[array_namean array created in this way is initialized with all zeros if the array type is number type arrays of objects are initialized to all null references once we have declared an array in this waywe can create the collection of cells for an array later using the following syntaxnew element_type[lengthwhere length is positive integer denoting the length of the array created typically this expression appears in an assignment statement with an array name on the left hand side of the assignment operator sofor examplethe following statement defines an array variable named aand later assigns it an array of cellseach of type doublewhich it then initializesdouble[ /various steps new double[ ]for (int = lengthk++ [