What is purpose of new operator
Answers
Answered by
16
Answer:
The primary purpose of new operator is to allocate memory for a variable or an object during run time. It is used instead of malloc() function. When new operator is used, the variables/objects are considered to be pointers to the memory location allocated to them.
Answered by
4
The 'new' operator in java is responsible for the creation of new object or we can say instance of a class. Actually, it dynamically allocates memory in the heap with the reference we define pointed from the stack. The dynamically allocation is just means that the memory is allocated at the run time of the program.
Similar questions