What will happen if you explicitly define a constructor with parameters but do not define a no-argument constructor?

Last Updated :
Discuss
Comments

What will happen if you explicitly define a constructor with parameters but do not define a no-argument constructor?


Java will provide a default no-argument constructor.

You cannot create an object without passing arguments.

Compilation error occurs.

The constructor will be inherited from Object class.


Share your thoughts in the comments