public class StringIndexOfTest { public static void main(String[] args) { String a = "10"; String b = "A10"; String c = "10A"; int index = a.indexOf("A"); //-1 int index2 = b.indexOf("A"); //0 int index3 = c.indexOf("A"); //2 } }