StringTokenizer hasMoreElements() in Java

hasMoreElements(): This method is available in java.util.StringTokenizer class of Java.

Syntax:

boolean java.util.StringTokenizer.hasMoreElements()

This method returns true if more tokens are available.

Parameters: NA

Returns: true if there are more tokens; false otherwise.

Exceptions: NA

Approach

Java

import java.util.StringTokenizer;

public class StringTokenizerhasMoreElements {
    public static void main(String[] args) {
        StringTokenizer stringTokenizer =
new StringTokenizer("Hello Java Program");

        System.out.println(stringTokenizer.hasMoreElements());
    }
}

Output:

true


No comments:

Post a Comment