非常小的问题,,路过的请帮忙,,小弟在线等
public class demo2{
public static void main(String[] args)
{
String text="fang xing is no one";
int count=0;
int index=0;
if(index!=-1)
{
count=count+1;
index=text.indexOf(' ',index);
index+=1;
}
System.out.println(count + "," + index);
}
}
为什么count的结果会是1????