A constructor which is not take any argument is called zero argument constructor.or also knows as Default constructor. all object of a class with default constructor are initialize to same set of value.in otherword we say that A default constructor is created only when we don't declare any constructor in our code. Then, by default, the compiler automatically creates a default constructor.
Q.) Example of Default constructor .
public class Student
{
int roll;
String className;
Student()
{
System.out.println("Body of default constructor");
}
public static void main(String arg[])
{
System.out.println("Object is going to create");
Student s1 = new Student();
}
}
Output
Object is going to create
Body of default constructor