Computer Science, asked by Ravindar44, 1 year ago

Difference between parameterized constructor and default constructor in java

Answers

Answered by darshan74
0
Parameterized constructor is having one or more parameters. Default constructor is used to initialize every object with same data. Parameterized constructor is used to initialized each object with different data. When no constructor written in the class then java compiler writes default constructor with default
Answered by amitaagarwal4827
1

A constructed that has no parameter is known as default constructor if you don't find a constructor in a class then compiler create default constructor for the class.

A constructor that has parameters is known as parameterized constructor in the want to initialise fields of the class with our own values then we use a parameterized constructor.

Similar questions