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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!