Can anyone explain to me this code. I got this problem while reading "HeadFirst Java 2nd Edition". I'm still dumb when it comes to arrays and loops.
Here is the code:
And this is the output:
It will also be a great help if someone suggest websites or techniques on how I can easily understand loops and arrays especially when arrays are under a loop or they appear similar to the problem that I posted here. These are my weakness. I want to be able to surpass this so that I can progress more in Java programming.
Go through the program line by line in your head, remembering what the values of variables are; in other words, try to run the program in your head. Tell us what you think happens, step by step. If there is a specific step you don't get, then explain us what step that is exactly and we'll help you clear the confusion.