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

 

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

Write a method that returns the input parameter string, but with the first and last letter removed. If the input parameter is "win the game", you should return "in the gam". The only string methods you are allowed to use are .substring and .length. You may assume the input parameter string will have at least two characters. If it ONLY has two characters, you will return an empty string.


ddd1RemoveFirstAndLast("Testing") → "estin"
ddd1RemoveFirstAndLast("abcdefg") → "bcdef"
ddd1RemoveFirstAndLast("make it shorter") → "ake it shorte"

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

public String ddd1RemoveFirstAndLast(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: 250

Copyright Nick Parlante 2017 - privacy