What will be the output of this program?

Last Updated :
Discuss
Comments

What will be the output of this program?

Java
class Demo {
    int num;
    Demo() {
        this(100);
        System.out.println("Default Constructor");
    }
    Demo(int n) {
        num = n;
        System.out.println("Parameterized Constructor");
    }
}
public class Main {
    public static void main(String[] args) {
        Demo obj = new Demo();
    }
}


Default Constructor

Parameterized Constructor

Parameterized Constructor
Default Constructor

Compilation Error


Share your thoughts in the comments