Skip to main content

Find number of characters in Longest word - Java Program

This java program finds the longest word in a string inputted by the user and prints the number of characters of that word.

Q. Write a program to input a sentence and print the number of characters found in the longest word of the given sentence. For example, if sentence is " India is my country", then the output should be 7.

Comments