The following code example demonstrates all three generic overloads of the LastIndexOf method. An array of strings is created, with one entry that appears twice, at index location 0 and index location 5. The LastIndexOf(J[],J) method overload searches the entire array from the end, and finds the second occurrence of the string. The LastIndexOf(J[],J,Int32) method overload is used to search the array backward beginning with index location 3 and continuing to the beginning of the array, and finds the first occurrence of the string. Finally, the LastIndexOf(J[],J,Int32,Int32) method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns –1 because there are no instances of the search string in that range.