Anonymous

What Is Purpose Of New Operator In JAVA?

2 Answers

Alongbar Daimary Profile
New Operator is used to create an instance of an object.  It is also used to create an Instance of a class. And if a class contains constructors, they are called by New operator at the time of its object creation.  Example1:  ArrayList lst = new ArrayList();  This statement is used to create a new object of type ArrayList  Example2: Myclass ABC=new Myclass(); here an instance of the class Myclass is created.
Florio Potter Profile
Florio Potter answered

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. For more information get help at CodeAvail- Online Computer Science Assignment
help

Answer Question

Anonymous