Java StringTokenizer.nextElement()
Syntax
StringTokenizer.nextElement() has the following syntax.
public Object nextElement()
Example
In the following code shows how to use StringTokenizer.nextElement() method.
// w w w . j av a 2 s .c o m
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
StringTokenizer st = new StringTokenizer("tutorial from java2s.com");
// moving to next element
st.nextElement();
// checking next to next element
System.out.println("Next element is : " + st.nextElement());
System.out.println("Next element is : " + st.nextElement());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »