contoh kode program string index out of bound exception di java

-luntas ilmu- berikut akan saya kasih contoh exception lagi tentang string index out of bound exception ini salah satu jenis runtime exception turunan klasnya.


package Latihan;
/**
 *
 * @author sayfudin
 */
public class soalStringIndex {
     static String divLine2 = " IS ";
     static String uInput = "A DOG IS TEST";

public static void main(String[] args)
{
    try{
    int i = uInput.indexOf(divLine2 + divLine2.length());
    System.out.println(uInput.substring(i));
    }catch(StringIndexOutOfBoundsException e){
        System.out.println("kesalan string indek " + e);
    }
}    
}

semoga manfaat ammin..