int countTokens();
Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception.
也就是你这么做
for(int i=0;i<str1.countTokens();i++)
{
System.out.println(i+""str1.nextToken());
}
OK
等加分了哦
Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception.
也就是你这么做
for(int i=0;i<str1.countTokens();i++)
{
System.out.println(i+""str1.nextToken());
}
OK
等加分了哦
class ShowToken{
public static void main(String[] args){
StringTokenizer str1;
String str="I Love This Game.";
str1=new StringTokenizer(str);
int i=0;
while(str1.hasMoreTokens())
{
i++;
System.out.println("i:"+str1.nextToken());
}
}
for(int i=0;i>=str1.countTokens();i++)
_____
class ShowToken{
public static void main(String[] args){
StringTokenizer str1;
String str="I Love This Game.";
str1=new StringTokenizer(str);
System.out.println(""+str1.countTokens());
int n=str1.countTokens();
for(int i=0;i<n;i++)
{
System.out.println(i+""+str1.nextToken());
}
}
}
这回没问题了,我试过了
你的我试了,但是有问题 什么也没与输出!呵呵
来这里 接分