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 

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

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner public class LongestWord public static void mainStrin... View full answer

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 Programming Questions!