AkhmadGhafirin
5/1/2017 - 10:22 PM

String Indeks

package exception;

/**
 * Created by ahmad on 30/04/17.
 */
public class StringIndexOutOfBounds {
    public static void main(String[] args) {
        try {
            String str = "abcdefghijklmnopqrstuvwxyz";
            System.out.println(str.length());
            char c = str.charAt(40);
            System.out.println(c);
        }catch (StringIndexOutOfBoundsException e){
            System.out.println("String Index Out Of Bounds Exception!");
        }
    }
}