What happens if you do not define a constructor in a Java class?

Last Updated :
Discuss
Comments

What happens if you do not define a constructor in a Java class?

The program will not compile.

The compiler provides a default constructor.

The class cannot be instantiated.

The constructor from another class will be used.


Share your thoughts in the comments