Write a method called multiConcat that takes a String and an integer as parameters. Return a String that consists of the string parameter concatenated with itself count times, where count is the integer parameter. For example, if the parameter values are "hi" and 4, the return value is "hihihihi". Return the original string if the integer parameter is less than 2.
What will be an ideal response?
```
public String multiConcat(String text, int count)
{
String result = text;
if (count > 1)
for (int i=2; i <= count; i++)
result += text;
return result;
}
```
You might also like to view...
Formatting marks the disk into ________ (rings) and sectors (wedges)
Fill in the blank(s) with correct word
One major discriminator in determining which tablet to choose is the ________ it runs
A) operating system B) software C) apps D) network
What are classes and objects? How are they used in object-oriented programming?
What will be an ideal response?
Which DNS server queries data from other DNS servers and stores the information in the cache until its expiration date?
A. Master server B. Slave server C. Caching-only server D. Forwarding server