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 Squirrels Website Admin 位于 CodeGym
20 四月 2022, 09:34
Output via main() is not required in this task.
0