所以我想要做的是回报:爪哇 - 从返回信息循环
输入为createMixedString(Hello,there,3)
,我想输出HellothereHellothereHellothere
我的问题是,当它运行它只是回报Hellothere
就好像程序没有看到我在for循环中做的重新分配。
public static String createMixedString(String s1, String s2, int n) {
String result = s1+s2;
for (int i=0;i>=n;i++) {
result = result+s1+s2;
}
return result;
}
检查条件,我认为你把“>”错误的方式。 – warbio 2012-02-07 01:23:54