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

 

amjadm@miamioh.edu assignmentiii > switchXO
prev  |  next  |  chance

Given a String, switch the "X" to "O" and vice versa, and return a new string.
Hint: Since you don't know the length of the string, you should use a loop, go through the string, check and switch characters one by one, and switch the characters as you are building up a new string.


switchXO("X") → "O"
switchXO("") → ""
switchXO("OX") → "XO"

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

public String switchXO(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: 190

Copyright Nick Parlante 2017 - privacy