What will be the output of the following code? class Test { Test(int x) {…

PYQ DSSSB 2025

What will be the output of the following code? class Test { Test(int x) { System.out.println("Parameterized Constructor"); } Test() { this(10); System.out.println("Default Constructor"); } public static void main(String[] args) { Test obj = new Test(); } }

  1. A.

    Parameterized Constructor followed by Default Constructor

  2. B.

    Compilation Error

  3. C.

    Default Constructor

  4. D.

    Parameterized Constructor

Attempted by 513 students.

Sign up free to check your answer

Sign up free

Explore the full course: Dsssb Tgt Computer Science Paper 2

Loading lesson…