Given the definition a concrete class C, it is instantiated by an expression of the form
new C( arguments )where the list of arguments matches a constructor for the class C. A simple example of the use of new for the class Entry appears immediately above. In general, a class may have several different constructors, but each constructor must have a distinct list of argument types (so the Java compiler can determine which one is meant!).
The following expression creates a DeptDirectory containing the office and phone information for Corky and Matthias:
new Cons(new Entry("Corky","DH3104","x6042"),
new Cons(new Entry("Matthias","DH3106","x5732"), new Empty()))
This syntax is wordy but straightforward.