Keep in mind that Strings are immutable- that means they never change. You can get certain substrings or characters from a String, but the original remains intact.
Type: Posts; User: KevinWorkman
Keep in mind that Strings are immutable- that means they never change. You can get certain substrings or characters from a String, but the original remains intact.
Yep, you could have just done word = word.substring(0, word.length()-1); or something like that.
Those seem like reasonably approaches. Or you could use a StringBuilder.
But think about the word growing in terms of an int. What you have is basically this:
int limit = 5;
for(int i = 0; i <...
Yeah, that is going to loop forever. Think about what you're doing- you're looping until the end of the word, but each iteration, you're adding a character to the word. That means you'll never be...