beyondgrader.com Logo
DemoBrowseAboutTeamLogin

String Doubled

Geoffrey Challen // 2020.9.0

Write a function called doubleString. Given a String "test", you should return "tteesstt". Given "HaHa!" you should return "HHaaHHaa!!". Given the String "" you should return "". Given the null String return null. There are several ways to approach this problem, and you may want to look into either the charAt or toCharArray String methods. Keep in mind that adding two characters together will be done mathematically. So, given a character 'x', if you want String concatenation you need to do x + "" + x.