Array declaration

In java you must allocate the memory for array frst by
type [] name=new type[size]
or
type name[] = new type[size]

Then if the type is not primitive you need to instantiate each field of the array by
array_name[i]=new type(constructor attributes)

Also, we can declare arrays like this
type array_name[]={val1,val2,val3};
Comments