Code a method that finds the last occurrence of an object in an array. The method should return the index of the object if found and –1 if not found.
What will be an ideal response?
```
int findLast(Object[] array, Object target)
int findLast (Object[] array, Object target)
{
for ( int i = numElements – 1; i >= 0; i-- )
if ( array[i].equals( target ) )
return i;
return -1;
}
```
Computer Science & Information Technology
You might also like to view...
When generating a request for a new x.509 certificate for securing a website, which of the following is the MOST appropriate hashing algorithm?
A. RC4 B. MD5 C. HMAC D. SHA
Computer Science & Information Technology
Adds or reduces spacing between letters.
a. Leading b. Kerning c. Tracking d. Text-indent
Computer Science & Information Technology