What is the difference between a default constructor and a parameterised constructor?

Last updated 5 July 2026

A default constructor takes no arguments and initializes an object with default or predefined state, while a parameterised constructor accepts arguments to initialize an object with caller-supplied values.

  • Default constructor:

    • No parameters; sets fields to defaults (zero, null, or hard-coded values).

    • In many languages the compiler generates one automatically if you declare no constructor at all.

  • Parameterised constructor:

    • Takes one or more arguments to build an object in a specific, meaningful state.

    • Lets you enforce required fields at creation time so no object exists in an invalid state.

  • Key trap: Once you declare any parameterised constructor, the compiler stops auto-generating the default one; add it explicitly if you still need it.

[lang:java] class Point { int x, y; Point() { this.x = 0; this.y = 0; } // default Point(int x, int y) { this.x = x; this.y = y; } // parameterised }

  • https://www.examclouds.com/java/java-core/constructors-default-parameterized-initialization
  • https://www.geeksforgeeks.org/cpp/what-is-constructor/
  • https://www.baeldung.com/java-constructors
  • https://www.geeksforgeeks.org/cpp/parameterized-constructor-in-cpp/
All Object-Oriented Programming interview questions