Menu

How To Design A Java Program That Reads A Sentence Say S Consisting Of Lower Cas

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.)

Leave a Reply

Your email address will not be published. Required fields are marked *