java.util.StringTokenizer.countTokens() 方法示例


java.util.StringTokenizer.countTokens() 方法示例

package com.codingdict;

import java.util.*;

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

      // creating string tokenizer
      StringTokenizer st = new StringTokenizer("codingdict is the best site");

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