September 2011
Beginner
650 pages
15h 47m
English
Now that you know more about classes and their constructors, let’s take a closer look at the new operator. In the context of an assignment, the new operator has this general form:
![]()
Here, class-var is a variable of the class type being created. The class-name is the name of the class that is being instantiated. The class name followed by a parenthesized argument list (which can be empty) specifies the constructor for the class. If a class does not define its own constructor, new will use the default constructor supplied by Java. Thus, new can be used to create an object of any class type. The new operator returns a reference ...
Read now
Unlock full access