Return the First Item from a Generic Array
easyQuestion 175Complete the generic method getFirst that takes an array of any type and returns its first element. You may assume the array always has at least one item.
IMPORTANT: Do NOT write a main method. A hidden test will call GenericTools.getFirst with a String array and an Integer array and print the first element from each.
Expected output
apple 7
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
GenericsMethods
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.