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

 

jebbert@volusia.k12.fl.us > quiz2021_10_12_APSLHL_longer
prev  |  next  |  chance

Write a method that returns the longer of the two input parameter strings. If the two strings are the same length, return "<same>" to indicate that. Note that returning "<same>" does NOT mean that the strings are the same, only that they are the same LENGTH. Look at the test data for examples.


quiz2021_10_12_APSLHL_longer("Punny joke.", "An ox named Abe is Abe Ox. But Abe Ox is not made out of cardboard.") → "An ox named Abe is Abe Ox. But Abe Ox is not made out of cardboard."
quiz2021_10_12_APSLHL_longer("Plate Leopard Easy Arm Spray Eagle Gate Empty Tarp Thing Hamper Igloo Steve Ramp Ice Gait Hat Temper", "it") → "Plate Leopard Easy Arm Spray Eagle Gate Empty Tarp Thing Hamper Igloo Steve Ramp Ice Gait Hat Temper"
quiz2021_10_12_APSLHL_longer("Much longer string", "short string") → "Much longer string"

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

public String quiz2021_10_12_APSLHL_longer(String str1, String str2) { }

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: 210

Copyright Nick Parlante 2017 - privacy