CJCoding With Joseph
15per day

Find the Index of a Generic Value

Complete the generic method findIndex that searches an array for a target value and returns the index of the first match. Return -1 if the value is not found.

Use .equals() for comparison.

IMPORTANT: Do NOT write a main method. A hidden test will search for "banana" (index 1) and "grape" (not found) in a String array and print the resulting indexes.

Expected Output:

1
-1
Topics:
GenericsMethods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.