Write a static method that receives a String and an integer. It should return a String consisting of the given number of copies concatenated.
For example, if "cat" and 4 are passed in, your method should return the String "catcatcatcat".
Either a for
loop or while
loop will be accepted.
Preconditions:
null
.Examples:
multiplyString("cat", 4)
returns "catcatcatcat"
multiplyString("cat", 1)
returns "cat"
multiplyString("x", 7)
returns "xxxxxxx"
multiplyString("schwifty", 0)
returns ""
©2003–2016 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.