代码如下,想输出两个字符串,结果老是重复,请大家帮忙
public class test {
public static void main(String[] args) {
String s="our future is ";
int k=0;
int i=0;
char c[]= new char[10];
for(i=0;i<s.length();k=i,i++){
i=s.indexOf(" ",k);
System.out.println(i);
s.getChars(k,i,c,0);
for(int j=0; j<c.length;j++) {
System.out.print(c[j]);
}
}
i++;
}
} |
|