Advertisement
Guest User

Help with Triple String

a guest
Jan 22nd, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public String tripleString(String str)
  2. {
  3. String answer = ""; // This is the empty string we will build into our answer.
  4. for(int i = 0; i < 3; i++)
  5. {
  6. // You don't need to print the answer 3 times we need
  7. // return the string repeated 3 times.
  8. // We can use += to glue a string on to the end of another.
  9. // answer += "Hello!" will add "Hello!" to the end of answer.
  10.  
  11.  
  12. }
  13. return answer;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement