What will be the output of this program?
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
This question is part of this quiz :
Java Constructors