Working of constructor with out parameter

when i use constructor without parameter like
public StackUsingArray( ){
this(DEFAULT_CAPACITY);
}
in this case how to initialized the value of top,size and data;

Hi @khans5854,
See in this case you are using a custructor with no parameter and in that constructor you are calling another constructor with parameter … Here this(DEFAULT_CAPACITY) refers to the StackUsingArray(int capacity) constructor with int capacity as parameter … So in the case of constructor with no parameter you have to yourself assign a default value to be assigned to the fields like size and top and in this case DEFAULT_CAPACITY is the size of Stack… Hope you get this .