This content has been marked as final. Show 4 replies
Okay, what's stopping you from learning how for loops work? I hope you have a good book on the Java language right next to you, otherwise your first order of business is to get one. But until you do, you might want to try the java tutorial:
Why are you stripping out '8'?
Just out of curiosity...
In the while loop, you have full control on when you increment the i and when not and what you do is correct.
Doing this with the for loop always increments the i. To avoid this, you may find out that when you removeChar, you have to decrement the i, just to be incremented by the loop right after.
All this would result in more obscure code than the while loop, therefore I would not use it.
Edit: Why you remove 8 in the while loop and 5 in the for loop remains a big mystery.
Edited by: baftos on Apr 25, 2013 11:56 AM
Many thanks baftos, didn't realize that i had to decrement i.
The 8 i remove it for fun, not for a special reason.
Many thanks again.