This looks like a puzzle which has stumped a few people in the past here on the forums. I looked at other people questions and the answers but I'm not sure if it helped me. I am trying to work the problem but I'm confused as to how certain pieces of the code works in general. This is page 90 of the Head First Java Book, second edition. I have a few questions to verify how things work so I hope I can communicate my questions correctly. I appreciate any help. Thank You!
Here is the full puzzle code:
Here are the specific lines I'm having problems with. These are lines 10 and 12 from above.
I'm currently working through the problem with pencil and paper and this is what I have this for the first loop.
For line # 11
is " m4a[x].counter" an array reference variable assigned the value of 1 ( counter being 0 at the time) ?
Would I read it as m4a.counter = 1?
For line #13
Is the variable "count" now assigned the value 1 plus it calls the maybeNew method?
Does it pass the argument "0" into the "maybeNew" method's parameter and then the "maybeNew" method returns 1?
If I'm correct on any of this would I then read this as count = 1+1?