Why Does Java Provide Default Constructor ?

In Java all the interaction takes place between Object instances. To create an Object instance, JVM needs a constructor. Java does not enforce the rule on a programmer to define a default constructor for every class.

Whenever an object has to be created and programmer has not provided a constructor, Java uses default constructor to create the object. Default constructor also initializes member variables with their default values.



You May Interest

Why Java Does Not Support Operator Overloading ?

How Will You Define the Scope of a Bean in Spring ?

What is the Difference Between Fail-fast and Fail-safe Iterator i ...

What is the Lifecycle Stages of JSP ?

Java How To Find The Average Of 10 Numbers Using A While Loop