What would be the java code for this problem?
Write a function, last, that takes two parameters, an array of strings, array, and a single
string, item. The function should return the index of the LAST occurrence of item in array. Use the
standard equals() method from string to do the equality check. If no element in array is “equal” to
item then return –1.
int l=ar.length;
for(int i=0;i
if(item.equals(ar[i])
return i;
}
return -1;
Java – string – equals

