0

Write a program to display the longest word along with the number of character in it...

input:: we are learning scanner class in java output:: the longest word : learning number of character : 8

6th Feb 2018, 2:43 PM
sushil gupta
sushil gupta - avatar
2 Answers
0
What you need to do is first "split" the string on every space, and hold the words in an array, then with a loop you go into every index with the length property, hold the string and compare with the next index, and hold the largest one until you are done, and then just print the info you need, like the string and it's length. Good luck Sushil.
7th Feb 2018, 9:12 PM
Roberto Guisarre
Roberto Guisarre - avatar
0
without using split method because this is not in our syllabus i.e. icse
8th Feb 2018, 2:56 PM
sushil gupta
sushil gupta - avatar