VOOZH about

URL: https://www.geeksforgeeks.org/java/stringtokenizer-nexttoken-method-in-java-with-examples/

⇱ StringTokenizer nextToken() Method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

StringTokenizer nextToken() Method in Java with Examples

Last Updated : 29 Jan, 2019
The nextToken() method of StringTokenizer class is used to return the next token one after another from this StringTokenizer. Syntax:
public String nextToken()
Parameters: The method does not take any parameters. Return Value: The method returns the next token present in the line of the string tokenizer. Below programs illustrate the working of nextToken() Method of StringTokenizer: Example 1:
Output:
The Next token: Lets
The Next token: practice
The Next token: at
The Next token: GeeksforGeeks
Example 2:
Output:
The Next token: Welcome
The Next token: to
The Next token: GeeksforGeeks
Comment