Search:

Type: Posts; User: curmudgeon

Search: Search took 0.07 seconds.

  1. [SOLVED] Re: java.lang.StringIndexOutOfBoundsException: String index out of range: 0

    You only want to get to the "next part" if the first if is true. Consider nesting your if blocks, putting the if (answer == 'n'... bit inside the if (size > 0) bit.
  2. [SOLVED] Re: java.lang.StringIndexOutOfBoundsException: String index out of range: 0

    You would need to use an if block, similar to what you're doing above, and it would make most sense to check for the size immediately before the error, putting your code where you extract your first...
  3. [SOLVED] Re: java.lang.StringIndexOutOfBoundsException: String index out of range: 0

    The String class has a method, length(), that tells you how long the String is. Consider checking this first before trying to extract a character that doesn't exist.
Results 1 to 3 of 3