NewExpression
NewExpression is a term used in programming language theory and documentation to describe an expression that creates a new instance of a class, struct, or array. In most compiled languages it corresponds to the syntax that allocates storage on the heap and initializes the object, while in dynamically typed languages it also controls prototype inheritance. The name stems from the keyword “new,” which appears in languages such as Java, C#, JavaScript and Swift.
In Java the syntax is new ClassName(constructorArguments), where the class constructor is invoked and the reference
From a memory management perspective a NewExpression typically allocates on the heap, making it subject to
Common pitfalls include omitted parentheses in languages that allow default constructors, unintentionally returning primitive values instead