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

 

davereed@creighton.edu > replaceChar
prev  |  next  |  chance

replaceChar() -- You are given a String and a character, and want to replace each occurrence of the character in the String with '*'. Your method should return that modified String.


replaceChar("foo", "o") → "f**"
replaceChar("yellow balloon", "o") → "yell*w ball**n"
replaceChar("capital", "a") → "c*pit*l"

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

public String replaceChar(String str, char ch) { }

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