Differentiate between parameterized and non parameterized constructor.
Answers
Answer:
The parameterized constructors are the constructors having a specific number of arguments to be passed. The purpose of a parameterized constructor is to assign user-wanted specific values to the instance variables of different objects. A parameterized constructor is written explicitly by a programmer.
Explanation:
1What is non parameterized constructor?
A Java constructor may or may not have any parameters (arguments). If a constructor does not accept any parameters, it is known as a no-arg constructor. For example, private Constructor() { // body
2
The parameterized constructors are the constructors having a specific number of arguments to be passed. The purpose of a parameterized constructor is to assign user-wanted specific values to the instance variables of different objects. A parameterized constructor is written explicitly by a programmer.