I assume you also want to change your while loop from:
while(namelength>0)
to
while(namelength>=0)
since the index 0 is a valid index.
Also, check the last if statement in your loop. I think you...
Type: Posts; User: aussiemcgr
I assume you also want to change your while loop from:
while(namelength>0)
to
while(namelength>=0)
since the index 0 is a valid index.
Also, check the last if statement in your loop. I think you...
Ok, you've made a very simple mistake that is very often seen in those who are new to programming. Your mistake has to do with the difference between how a human counts and how the computer counts....
Actually your error is occurring at the line
char x = name1.charAt(namelength);
You are probably incrementing namelength or decreasing the size of name1 somewhere, but not checking your...