![java default constructor java default constructor](https://s3.amazonaws.com/webucator-how-tos/1890.png)
If there are no constructors added by you, then compiler generated default constructor will look like this.
![java default constructor java default constructor](https://i.ytimg.com/vi/7rqlO3nhVJI/maxresdefault.jpg)
In your case, there is no default constructor as you are adding them programmatically. If a class doesn't have any constructor provided by programmer, then java compiler will add a default constructor with out parameters which will call super class constructor internally with super() call. the constructor has exactly the same effect whether they are included or not.the question got the defaults wrong, and.However, I am leaving it the answer because Technically it is not the constructor (default or otherwise) that default-initialises the fields. If a class contains no constructor declarations, then a default constructor with no formal parameters and no throws clause is implicitly declared. However, if you define at least one constructor, the default constructor is not generated. This is exactly the same as public Module()Īnd exactly the same as having no constructors at all. For your example, it would look like this assuming that the types are String, int and int, and that the class itself is public: public Module() Any uninitialised fields will be set to their default values. The default constructor is the no-argument constructor automatically generated unless you define another constructor.