Search:

Type: Posts; User: aussiemcgr

Search: Search took 0.11 seconds.

  1. Replies
    9
    Views
    5,478

    Re: String index is out of range

    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...
  2. Replies
    9
    Views
    5,478

    Re: String index is out of range

    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....
  3. Replies
    9
    Views
    5,478

    Re: String index is out of range

    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...
Results 1 to 3 of 3