We say in Java, that whenever we write a class and try to create an object for the same class, the compiler creates a default constructor of that class even though it has not been defined by the user. So suppose I have one class
class Constructor {
public Constructor(int a, int b) {
}
}
public class ConstructorLearn {
public static void main(String ar[]){
Constructor c = new Constructor();//Compile time error
}
}
Now in the above class, I have not defined any constructor, but a parameterized constructor. Then why it is giving a compile-time error, because JVM should automatically create a default constructor when encountered new keyword.