1.

Which of these operators is used to allocate memory to array variable in Java?(a) malloc(b) alloc(c) new(d) new mallocThis question was addressed to me at a job interview.The above asked question is from Arrays topic in section Data Types, Variables and Arrays of Java

Answer»

Right choice is (c) new

To elaborate: Operator new allocates a block of MEMORY SPECIFIED by the size of an ARRAY, and gives the reference of memory allocated to the array variable.



Discussion

No Comment Found

Related InterviewSolutions