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
等加分了哦

解决方案 »

  1.   

    import java.util.StringTokenizer;
    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());
    }
    }
      

  2.   

    补上一个错误
    for(int i=0;i>=str1.countTokens();i++)
                _____
      

  3.   

    用空格字符判断字符数量:spacenum+1 is printnum.
      

  4.   

    import java.util.StringTokenizer;
    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());
            }
       }
    }
    这回没问题了,我试过了
      

  5.   

    softgq(英雄小强) 
    你的我试了,但是有问题 什么也没与输出!呵呵
      

  6.   

    ==你来接分 softgq(英雄小强)  哈哈 我两个都用了 谢谢了  先给他 ==你来!
      

  7.   

    http://expert.csdn.net/Expert/topic/2898/2898759.xml?temp=.3480799
    来这里 接分