Declaring an object of type Box
As just explained the new operator dynamically allocates memory for an object. It has this common form:
class-var = new classname();
In the example, class-var is a variable of the class type being created. The classname is the name of the class which is being instantiated. The class name followed through parentheses specifies the constructor for the class. A constructor describes what occurs whenever an object of a class is created. A Constructor is an important part of all classes and has several significant attributes. More real world classes explicitly constructor is specified and then Java will automatically supply a default constructor. This is the case along with box. For now, we will use the default constructor. In short, you will see how to describe your own constructor.