Core Java: Constructor chaining with this(...) reuses initialization logic

Calling this(...) as the first statement of a constructor delegates to another constructor of the same class, so shared setup lives in one place instead of being copied.

Code
class Point {
    final int x, y;
    Point() {
        this(0, 0);
        System.out.println("no-arg constructor finished");
    }
    Point(int x, int y) {
        this.x = x;
        this.y = y;
        System.out.println("full constructor: (" + x + ", " + y + ")");
    }
}
Point p = new Point();
System.out.println("p = (" + p.x + ", " + p.y + ")");
Output
full constructor: (0, 0)
no-arg constructor finished
p = (0, 0)
Advertisement
More in JAVA

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-09-27

© Java Coding Hub · About · Contact · Privacy · Terms