StringTokenizer st = new StringTokenizer("Hello, World|of|Java", ", |"); while (st.hasMoreElements()) System.out.println("Token: " + st.nextElement());