id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

andersoniii.edwin@cusd80.com > longestWord
prev  |  next  |  chance

Write the method called “longestWord”. This method receives a string and returns a word (String) from the given string that is the longest. Given: I Love Java – this would return Java. If there is more than one word as the "longest", then return the last "longest" word. We will assume the words are separated by just one space... No beginning space, but there will always be a space at the end.


longestWord("I Love Java ") → "Java"
longestWord("Math Is For Champions ") → "Champions"
longestWord("What a good day ") → "good"

...Save, Compile, Run (ctrl-enter)

public String longestWord( String phrase){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 100

Copyright Nick Parlante 2017 - privacy