Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String tripleString(String str)
- {
- String answer = ""; // This is the empty string we will build into our answer.
- for(int i = 0; i < 3; i++)
- {
- // You don't need to print the answer 3 times we need
- // return the string repeated 3 times.
- // We can use += to glue a string on to the end of another.
- // answer += "Hello!" will add "Hello!" to the end of answer.
- }
- return answer;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement