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

 

tmhscs@gmail.com strings > string_dictionaryOrder
prev  |  next  |  chance

string_dictionaryOrder--Given two Strings containing a single word each return them both words as a single string in dictionary order (alphabetically) with a comma and a space separating the two words.

If the two words are the same return a String containg a message saying: "'word1' and 'word2' are the same word."

If one of the Strings is empty return the other String, but if both are empty return a message saying "There are no words to compare."


string_dictionaryOrder("Apple", "Bear") → "Apple, Bear"
string_dictionaryOrder("Dog", "Cat") → "Cat, Dog"
string_dictionaryOrder("Mouse", "Mouse") → "Mouse and Mouse are the same word."

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

public String string_dictionaryOrder(String word1, String word2){ }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy