Citra Dil wrote:
1.As counter is defined before while loop, m4a[x].counter = 0 always isnt it?
also m4.counter = 0 always isnt it?
Yes. the reason is you are creating a new object every time.
Citra Dil wrote:
2.I did not understand how the method maybeNew(x) works
though the value of x (index) changes, return 1 gives the total outcome as "1" isnt it?
3.for eg. when x=0,
count = count + m4a[0].maybeNew(0)
index < 5
I am stuck here.
here i dont get your point. probably you are trying to tell that how this m4a[x].maybeNew(x); works?
if yes, in while loop you are creating a new object and place the object in index of x , and then you are accessing the object by m4a[x] then executing the method. and whatever value passing to the method < 5 then method returns 1 else 0. the object/m4 created by method maybeNew will be garbage collected.