0% found this document useful (0 votes)
9 views1 page

Java: Longest Word in String

Uploaded by

vivekpvns678
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Java: Longest Word in String

Uploaded by

vivekpvns678
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Basics java string and array questions :

1 . Find the longest word in the string .

public static String findLongestWord(String sentence) {

String str="";

String[] words=[Link](" ");

for(String word : words)

if([Link]()>[Link]())

str=word;

return str;

You might also like