A constructor which has a specific number of parameters is called a parameterized constructor. Why use the parameterized constructor? The parameterized constructor is used to provide different values to distinct objects. However, you can provide the same values also.
Following is the example of parameterized constructor. In this example, we have created the constructor of Student class that have two parameters. We can have any number of parameters in the constructor.
Output