Java tutorial
import java.util.StringTokenizer; public class Main { public static void main(String[] args) { StringTokenizer st = new StringTokenizer("tutorial from java2s.com"); // counting tokens System.out.println("Total tokens : " + st.countTokens()); // checking tokens while (st.hasMoreTokens()) { System.out.println("Next token : " + st.nextToken()); } } }