i'm fairly new to java and i'm trying to use indexOf to check if a persons name ends with the letters in the array and output a word it rhymes with. Where am i going wrong? e.g. Dean ends in "ean" so it rhymes with green. Thanks guys
String [] first = new String [3];
first [0] = "eem";
first [1] = "een";
first [2] = "ean";
for (int i = 0; i < first.length; i++) {
if (first[i].indexOf(first.length) != -1){
System.out.println("That rhymes with green");
}
}