Want to get rid of an error in java

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:687)
at rent.main(rent.java:24)

how to prevent this error?
shreyansjain
Asked Oct 31, 2012
It sounds like you have defined a list of strings(alpha numeric characters) and later in the sequence you are referring to a string in the list that is out of the defined range. For example if you define a list for 100 strings like 0-100 and you later refer to a string with an index of 101 or -1, they would be outside those boundaries.

To get rid of the error, you must either increase the boundaries or limit the range of indexes you're calling to numbers within the existing boundaries.

http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/StringIndexOutOfBoundsException.html
Rob
Answered Oct 31, 2012
Edited Oct 31, 2012

TIP: If it's not your answer to this question, please click "Leave a Comment" button under the question to communicate with the question owner.

Categories