Note: It is called constructor because it constructs the values at the time of object creation . It is not necessary to write a constructor for a class. It is because java compiler creates a default constructor if your class doesn’t have any.
Note: It is called constructor because it constructs the values at the time of object creation . It is not necessary to write a constructor for a class. It is because java compiler creates a default constructor if your class doesn’t have any.