Default Constructor in java program

What is default constructor?

– In java program, when we set same class name and method name that is called constructor structure in java program. And when we set null argument as method it’s call default constructor.

Constructor method does not have return type.

3 types of constructor available in java program.

1) Default constructor, 2) parameter constructor, 3) copy constructor


In this blog we are working on default constructor programs.



Let’s see example on default constructor.

class A


            A()       // class name == Method name | No return type like void, int etc


                        System.out.println(“Welcome in Earn online Money with Portal Isssearch”);

                        int i=1; 



                                    System.out.print(i + “ ”);          






class clEx9


            public static void main(String args[])


                        // Create an object of class A

                        A a1 = new A();            // Call to A() constructor in class A


                        // When we create an object and call to constructor


                        // another process to call default constructor

                        new A();           // call to A() in class A





Welcome in Earn online Money with Portal Isssearch

1 2 3 4 5 6 7 8 9 10

Welcome in Earn online Money with Portal Isssearch

1 2 3 4 5 6 7 8 9 10


This is very simple example of constructor. We can use two methods for call constructor method in java program.


Video available on YouTube.


If you have query about this blog, you can directly post comment or subscribe on website.


887total visits,1visits today


Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Comments are closed.