Many a time I have got an exception saying “the default constructor’s implementation is missing”. And many a times a parameterized constructor’s definition alone does everything. I want to know under which conditions this happens.
Many a time I have got an exception saying the default constructor’s implementation is
Share
The compiler doesn’t ever enforce the existence of a default constructor. You can have any kind of constructor as you wish.
For some libraries or frameworks it might be necessary for a class to have a default constructor, but that is not enforced by the compiler.
The problem you might be seeing is if you have a class with a custom constructor and you don’t have an implicit
super()call in your constructor body. In that case the compiler will introduce a call to the super classes default constructor. If the super class doesn’t have a default constructor then your class will fail to compile.