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