Question: JAVA Code: Complete the method, longestWord(), below that takes in an array of Strings and returns the longest String in the array. Note: you may
JAVA Code:
Complete the method, longestWord(), below that takes in an array of Strings and returns the longest String in the array. Note: you may assume the Strings in the array are of different lengths.
For example, if the given array is: ["cat", "horse", "elephant", "bird"] then the method should return "elephant"
Starter Code:
public class StringMethod { public static String longestWord(String[] words) { //TODO: Complete this method } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
