java.util.StringTokenizer.hasMoreTokens() 方法


java.util.StringTokenizer.hasMoreTokens() 方法

package com.codingdict;

import java.util.*;

public class StringTokenizerDemo {
   public static void main(String[] args) {

      // creating string tokenizer
      StringTokenizer st = new StringTokenizer("Come to learn");

      // counting tokens
      System.out.println("Total tokens : " + st.countTokens());

      // checking tokens
      while (st.hasMoreTokens()) {
         System.out.println("Next token : " + st.nextToken());    
      }
   }
}