Initialize array
In a declaration, an array initialize might be specified. It also might be specified as an array creation expression part, that gives certain initial values and creates an array. ArrayInitializer: { VariableInitializersopt ,opt } VariableInitializers: VariableInitializer VariableInitializers , VariableInitializer To make it further clear: VariableInitializer: Expression ArrayInitializer ...
One can create an array by the help of the new operator. In ArrayDemo program, next statement allocates the array along with quite enough memory. This is done for 10 integer elements so that to assign array to anArray variable. Java Code: // create an array of integers anArray = new int[10]; In case if the given statement is missing, an error like this would be printed by compiler and also the compilation would fail. To array’s each element, ...
// create an array of integers anArray = new int[10];
Size Reduced for Images in PDF &...
05-15-2013, 05:53 PM in Java Software