later in this and others throughout this book the basics of arrays in java the preceding section showed graphically the primary algorithms used for arrays now we'll see how to write programs to carry out these algorithmsbut we first want to cover few of the fundamentals of arrays in java if you're java expertyou can skip ahead to the next sectionbut even and +programmers should stick around arrays in java use syntax similar to that in and +(and not that different from other languages)but there are nevertheless some unique aspects to the java approach creating an array as we noted in there are two kinds of data in javaprimitive types (such as int and double)and objects in many programming languages (even object-oriented ones like ++arrays are primitive typebut in java they're treated as objects accordingly you must use the new operator to create an arrayint[intarray/defines reference to an array intarray new int[ ]/creates the arrayand /sets intarray to refer to it or the equivalent single-statement approachint[intarray new int[ ]the [operator is the sign to the compiler we're naming an array object and not an ordinary variable you can also use an alternative syntax for this operatorplacing it after the name instead of the typeint intarray[new int[ ]/alternative syntax howeverplacing the [after the int makes it clear that the [is part of the typenot the name because an array is an objectits name--intarray in the code above--is reference to an arrayit' not the array itself the array is stored at an address elsewhere in memoryand intarray holds only this address arrays have length fieldwhich you can use to find the sizein bytesof an arrayint arraylength intarray length/find array length remember that this is the total number of bytes occupied by the arraynot the number of data items you have placed in it as in most programming languagesyou can' change the size of an array after it' been created accessing array elements array elements are accessed using square brackets this is similar to how other languages work