public class StringHelper {
public static String multiply(String s) {
String result = "";
for (int i = 1; i <= 5; i++) {
result = result.concat(s);
}
System.out.println(result);
return result;
}
public static String multiply(String s, int count) {
String result = "";
for (int i = 1; i <= count; i++) {
result = result.concat(s);
}
System.out.println(result);
return result;
}
public static void main(String[] args) {
StringHelper text = new StringHelper();
text.multiply("Sharry");
text.multiply("Amigo", 3);
}
}
评论 (1)
- 热门
- 最新
- 最旧
您必须 登录 才能发表评论
John SquirrelsWebsite Admin,在 CodeGym
20 四月 2022, 09:34
Output via main() is not required in this task.
0