Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
I'm pretty new to programming and I'm getting a error which I'm sure is a easy fix for more experienced people. Here is what I have: import java.io.*; import java.util.Scanner; public class ReadNamesFile { public static void main(String[] args) throws IOException { // make the names.csv comma-separated-values file available for reading FileReader f = n...
I wrote this little function just for practice, but an exception ("String index out of range: 29") is thrown and I don't know why... (I know this isn't the best way to write this function and can I use regular expressions.) This is the code: public String retString(String x) { int j=0; int i=0; StringBuffer y = new StringBuffer(x); try { while ( y.charAt(i) != '\0' ) ...
 /*
  * Copyright 1994-2000 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Sun designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */
package java.lang;

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.

Author(s):
unascribed
Since:
JDK1.0
See also:
String.charAt(int)
public
Constructs a StringIndexOutOfBoundsException with no detail message.

Since:
JDK1.0.
        super();
    }

    
Constructs a StringIndexOutOfBoundsException with the specified detail message.

Parameters:
s the detail message.
        super(s);
    }

    
Constructs a new StringIndexOutOfBoundsException class with an argument indicating the illegal index.

Parameters:
index the illegal index.
    public StringIndexOutOfBoundsException(int index) {
        super("String index out of range: " + index);
    }
New to GrepCode? Check out our FAQ X