Find the longest word when there are multiple longest words


How to design a Java program that reads a sentence, say s, consisting of lower-case words with .nextLine() method, identifies the words using .indexOf() and .substring() methods and saves them in String variables. Then the program will perform the following two operations:

a) Find the longest word When there are multiple longest words print the first one.

b) Sort the words in s in the alphabetical order. They will be rearranged to (Use .comparedTo() method.)

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Find the longest word when there are multiple longest words
Reference No:- TGS02909203

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)