Home » java » Java StringTokenizer countTokens() Method

Java StringTokenizer countTokens() Method

This method is used to count the number of the tokens from current token position to the last token

Signature

public int countTokens()

Parameters

NA

Return

Return the number of tokens available from specific token position

Example

Initially token position was before the first word “Arise” so on calling st.countToken() returns 11.
on calling st.nextToken() position of token is incresed by one and it is on “Arise” from this position new token count is 10.

Managed by MochaHost - Fast & Easy WordPress Hosting