Question: a. Write a Java method called longestWord that takes one argument which is a single-dimension array of String of name words and return the
a. Write a Java method called longestWord that takes one argument which is a single-dimension array of String of name words and return the longest string which has maximum number of characters. b. In the main method, define an array of String named sentence with 10 items. read from the user the 10 words and store them in the array sentence. call the method longestWord to determine the longest word and then print it. Sample Run: Enter a sentence with 10 words: The Sunday trip was more expensive than he first thought. The longest word is: expensive Activate Windows
Step by Step Solution
There are 3 Steps involved in it
import javautilScanner public class LongestWord public static void mainStrin... View full answer
Get step-by-step solutions from verified subject matter experts
