What will be the output of this program?

Last Updated :
Discuss
Comments

What will be the output of this program?

Java
class A {
    private A() {
        System.out.println("Private Constructor");
    }
    public static void createInstance() {
        new A();
    }
}
public class Main {
    public static void main(String[] args) {
        A.createInstance();
    }
}


Compilation Error

Private Constructor

Runtime Error


No Output

Share your thoughts in the comments