The new operator is used in Java to create new objects . It can also be used to create an array object. Let us first see the steps when creating an object from a class − Declaration − A variable declaration with a variable name with an object type. Instantiation − The ‘new’ keyword is used to create the object.
Read moreWhat is the purpose of new keyword?
New keyword in JavaScript is used to create an instance of an object that has a constructor function . On calling the constructor function with ‘new’ operator, the following actions are taken: A new empty object is created.
Read more