Java tutorial
public class MainClass { public static void main(String args[]) { String letters = "abcdefghijklmabcdefghijklm"; System.out.printf("Last \"def\" is located at index %d\n", letters.lastIndexOf("def")); System.out.printf("Last \"def\" is located at index %d\n", letters.lastIndexOf("def", 25)); System.out.printf("Last \"hello\" is located at index %d\n", letters.lastIndexOf("hello")); } }