Describe parameterised constructor in java ! Please explain it with various examples and make it crystal clear.
Answers
Answered by
1
Answer:
Parameterized Constructor – A constructor is called Parameterized Constructor when it accepts a specific number of parameters. To initialize data members of a class with distinct values. ... With a parameterized constructor for a class, one must provide initial values as arguments, otherwise, the compiler reports an error.
Attachments:
Answered by
4
▬▬▬▬ ▬▬▬▬
⭐ A parameter or argument is the data variable that a method takes when called and perform operations on them . in that program the add method is adding two numbers that are created and assign the value inside the method .
⭐ Thus parameterised constructor can be defined as the constructor which can accept parameters or arguments
⭐ Have a look at the picture it's a perfect example
Attachments:
Anonymous:
☘️Perfect
Similar questions