KnowledgeBoat Logo
|

Computer Applications

Describe the importance of parameterised constructors.

Java Constructors

2 Likes

Answer

Parameterized constructors are important because they provide a way to initialize objects with different values. For example, if we have a class representing a bank account, we could use a parameterized constructor to initialize a bank account with a specific balance, rather than always starting with a balance of zero. This makes the class more flexible and reusable, as it can be used to create objects with a variety of different initial states.

Answered By

1 Like


Related Questions