Default Constructor in Java | Java Tutorials

This  Java Tutorials “Default Constructor in Java” post explains clearly what is default constructor in java and how to check compiler added default constructor after compilation.


 

Default constructor:

  • Compiler raises an error, if we try to access un defined method in java application.

 

  • In the process of Compilation, compiler is looking for constructor definition in the java source file.
  • If not present, Compiler will supply a default constructor.
  • Default constructor is not taking any arguments and with empty definition.

 

  • Static block executes only once at the time of class loading.
  • Non-static block and constructor executes every time in the process of object creation.

 

Share this