# Module 7: Constructor

MODULE OVERVIEW

This module introduces constructors in Java and explains how they are used to
initialise objects when they are created.



Learners will explore the purpose of constructors, understand default and
parameterized constructors, and learn how constructor overloading allows objects
to be initialised in different ways.



The module also covers the differences between constructors and methods, helping
learners understand how constructors support object creation and initialisation
within object-oriented programming.






WHAT WILL BE COVERED


7.1 WHAT IS A CONSTRUCTOR?

 * Understanding the purpose of constructors in Java.

 * Exploring how constructors initialise objects.

 * Understanding constructor naming rules.

 * Learning how constructors are called when objects are created.

 * Identifying the role of constructors in setting initial object values.

 * Understanding how constructors differ from regular class methods.


7.2 DEFAULT CONSTRUCTOR

 * Understanding what a default constructor is.

 * Exploring the default constructor provided by Java.

 * Understanding when Java automatically provides a default constructor.

 * Creating objects using a default constructor.

 * Understanding how default values are assigned to object variables.

 * Using default constructors to initialise objects.


7.3 PARAMETERIZED CONSTRUCTOR

 * Understanding the purpose of parameterized constructors.

 * Defining constructors with parameters.

 * Passing values during object creation.

 * Initialising object attributes using constructor parameters.

 * Creating multiple objects with different initial values.

 * Applying parameterized constructors to initialise business-related objects.


7.4 CONSTRUCTOR OVERLOADING

 * Understanding the concept of constructor overloading.

 * Defining multiple constructors within the same class.

 * Using different parameter lists for constructors.

 * Understanding how Java identifies the appropriate constructor.

 * Initialising objects in different ways.

 * Applying constructor overloading to support different object creation
   requirements.


7.5 DIFFERENCE BETWEEN CONSTRUCTOR AND METHOD

 * Understanding the purpose of constructors and methods.

 * Comparing constructor and method names.

 * Understanding how constructors are called during object creation.

 * Exploring how methods are called to perform specific operations.

 * Understanding the return type differences.

 * Identifying when to use constructors and when to use methods in Java
   applications.


SKILLS YOU WILL GAIN

 * Understanding constructors and their role in object initialisation.

 * Creating and using default constructors.

 * Defining parameterized constructors.

 * Passing values during object creation.

 * Implementing constructor overloading.

 * Initialising object attributes through constructors.

 * Understanding the differences between constructors and methods.

 * Applying constructor concepts when developing Java classes and objects.


LEARNING OUTCOMES

By the end of this module, learners will be able to:

 * Define constructors to initialise objects when developing Java applications.

 * Use default constructors to create objects with initial values.

 * Apply parameterized constructors to initialise business entities with
   specific information.

 * Create overloaded constructors to support different object initialisation
   requirements.

 * Select appropriate constructors when creating objects with different sets of
   data.

 * Distinguish between constructors and methods based on their purpose and
   behaviour.

 * Develop well-structured Java classes with appropriate object initialisation
   techniques.

 * Apply constructor concepts when building reusable components for business and
   enterprise applications.


CERTIFICATION ALIGNMENT

This module develops Java object initialisation and constructor concepts that
support the broader learning pathway towards the Oracle Certified Professional:
Java SE 17 Developer certification.

The topics covered help learners understand constructor behaviour, object
creation and constructor overloading within Java applications.


CONTINUE TO THE NEXT MODULE

Continue to Module 8: Inheritance to learn how Java classes inherit properties
and methods, explore different inheritance types, work with the super keyword
and understand method overriding.