java - How do I make a word repeat? -


This question is already an answer here

  • 4 replies

I have a word too Repeat in java three times with return statement. I want to see it as "wordwordword" apart from how will I make a different method so that each letter can be repeated 3 times? So that it looks like "wwwooorrrddd" here i have so far (i also need to use a return statement)

static string repeatText (string text) {string repeat. Repeat = text; Repeat return + repeat + repeat; }

  public static void {String [] args) {system. Out.println (repeatText ("bar")); Println (changeText ("bar")); } Public Static String Repeated Text (String Text) {String Temp = ""; For (int i = 0; i & lt; text.length (); i ++) temporary + = text; Return temporary; } Fixed string change text (string text) {string tag = ""; For (int i = 0; I & lt; text.length (); i ++) for (int j = 0; j & lt; text.length (); j ++) temporary + = text.substring (I, I + 1); Return temporary; }  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -