Object Instantiation

Python Java
The form for object instantiation is

<class name>(<arguments>)

Example:

account = CheckingAccount(“Ken”,

                          “1111”,

                          500.00)

The form for object instantiation is

new <class name>(<arguments>)

Example:

CheckingAccount account = new CheckingAccount(“Ken”,

                                              “1111”,

                                              500.00)

Generic collections require one or more type parameters for the element types as well, of the form

new <class name><element types>(<arguments>)

Example:

List<String> names = new ArrayList<String>();

© Ken Lambert. All rights reserved.