Is it necessary to declare default constructor
while using parameterized constructor?
We can create parameterized object of that class
, and the object can be used to call other function of that class, then why do we need default constructor?
public class Const {
Const(int s,int t) {
int b=s+t;
System.out.println(b);
}
public int add(int a) {
int j = 9;
j=j+a;
return j;
}
}
public class Construct {
public static void main(String[] args) {
Const obj =new Const(5,9);
obj.add(55);
}
}
Here we don't need for default constructor. Can we not go with this object?