java.lang.StringIndexOutOfBoundsException

String index out of range: 1

Samebug tips1

Thrown by String methods to indicate that an index is either negative or greater than the size of the string. For some methods such as the charAt method, this exception also is thrown when the index is equal to the size of the string.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web4603

  • String index out of range: -1
  • via GitHub by dlsniper
    , 1 year ago
    String index out of range: 1
  • Stack trace

    • java.lang.StringIndexOutOfBoundsException: String index out of range: 1 at java.lang.String.charAt(Unknown Source) at BattleShip.main(Battleship.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Once, 5 months ago
    2 times, 10 months ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 1 year ago
    34 more bugmates