I am currently going through the book Absolute Java, 5/E and when I reached this problem I was stumped. I couldn't figure out to do this, so I looked online and found this (Yes, Riley is a bad lazy boy). This program works, but I don't understand why.
My question is this:
How do the 'for' statements know to what is the correct number to stop on for the statement to be correct? Is the 'if' statement directly below controlling it?
edit: I figured I might as well state that I just started learning Java (and programming) about 2 weeks ago. This is not an excuse for blatantly plagerizing someone else's code.
1st clause: letterT = 0 initializes the iterator
2nd clause: letterT < 10 sets the condition for loop continuance (the loop will continue while the condition is true)
3rd clause: letterT++ updates iterator on every iteration