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

What is the Difference Between init-param and context-param in JS ...

What is the Reason For Overriding equals Method in Java ?

What is the Importance of hashCode and equals Methods in Java ?

What is a Filter in JSP ?

What is the Use of Run Time Polymorphism in Java ?