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