使用StringTokenizer将Java String转换为标记


使用StringTokenizer将Java String转换为标记

import java.util.*;

public class StringTokenizerDemo {

   public static void main(String[] args) {

      // creating string tokenizer

      StringTokenizer st = new StringTokenizer("Come to learn");

      // checking elements

      while (st.hasMoreElements()) {

         System.out.println("Next element : " + st.nextElement());

      }

   }

}