Object Creation

This lesson summarizes the important details for object creation in Java.

We'll cover the following...

Notes on Instantiating Objects

  1. Static factory methods should be preferred to constructors when designing classes. Designing classes this way offers more flexibility when returning objects, for instance:

    • We can return an object of a subclass of the return type.

    • We can choose not to return a new instance everytime. Singleton and ...