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

 

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

Write a method that returns a string in reverse order. There is a slight "catch" however. If the string has an odd number of characters, omit the middle character from the reversed string. If there are an even number of characters, simply return the reversed string in its entirety. The only string methods you are allowed to use are .length, .equals, .substring, and .charAt. Of course you do not need to use ALL of these methods. Recursion is optional.


rrr1reverseString("") → ""
rrr1reverseString("bogus") → "suob"
rrr1reverseString("Ebbert") → "trebbE"

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

public String rrr1reverseString(String str) { }

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

Copyright Nick Parlante 2017 - privacy