
import java.util.Scanner;

public class IndexOf1
{
    public static void main(String[] args)
    {
        // Index:    0123456789
        String s1 = "XABCXXABCX";
        int i;

        i = s1.indexOf("ABC");  // "ABC" found at position 1
        i = s1.indexOf("XX");   // "XX"  found at position 4
        i = s1.indexOf("XY");   // "XY" is not found in s1: -1
    }
}
