What is used of new keyword in Java?



Suraj Said

+0 -0

In Java, the "new" keyword is used to create an instance of a class or an object. When a new object is created, memory is allocated for the object, and the constructor of the class is called to initialize the object's state.
The general syntax for creating a new object is:
ClassName objectName = new ClassName();



Submit Your Response