Question discussion

Which of the following operator in java can be used to allocate memory to array variable?

157696Medium 1 reply 609 views

Discussion 1

0
CCommunity
The new operator is followed by a call to a constructor, which initializes the new object.

Syntax for Instantiation of an Array in Java:

datatype array_name = new datatype[size];

It allocates memory for array elements. Once the length of the array is defined, it cannot be changed in the program.