sir in normal ctor
syntax is:
public StackUsingArrays(int capacity)throws Exception {
if(capacity < 1) {
throw new Exception(“Invalid Size”);
}
this.data = new int[capacity];
this.top = -1;
}
///but why in default ctor
public StackUsingArrays() throws Exception {
this(DEFAULT_CAPACITY);
}
//////and not
public StackUsingArrays() throws Exception {
this.data = new int[DEFAULT_CAPACITY];
this.top = -1;
}