VOOZH about

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

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


  • Courses
  • Tutorials
  • Interview Prep

StringTokenizer hasMoreTokens() Method in Java with Examples

Last Updated : 28 Jan, 2019
The hasMoreTokens() method of StringTokenizer class checks whether there are any more tokens available with this StringTokenizer. Syntax:
public boolean hasMoreTokens()
Parameters: The method does not take any parameters. Return Value: The method returns boolean True if the availability of at least one more token is found in the string after the current position else false. Below programs illustrate the working of hasMoreTokens() Method of StringTokenizer: Example 1:
Output:
The number of Tokens are: 4
true
The Next token: Lets
The Next token: practice
The Next token: at
The Next token: GeeksforGeeks
Example 2:
Output:
The number of Tokens are: 0
false
Comment