Why Java doesn't provide default constructor, if class has parametrized constructor? Consider the following example
class A {
int a;
public A() {
}
public A(int val) {
a = val;
}
}
Here I explicitly need to add default constructor. Is there any reason, why Java doesn't provide default constructor for class having parametrized constructor?
public A() {}is not a default constructor.) The OP was probably mixing up terminology and probably actually asking about no-argument constructors. Maybe the question should be edited if we are to assume the OP was mixing up terminology.