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..