Java StringTokenizer

It is the specially designed class for tokenization activity.
This class is present in java.util package.

import java.util.*;
class RegExDemo5 {
    public static void main(String[] args) {
        StringTokenizer st = new StringTokenizer("Silan Software");
        while (st.hasMoreTokens()) {
            System.out.println(st.nextToken());
        }
    }
}

Output
Silan
Software

Note : The default regular expression of StringTokenizer is space.

StringTokenizer st=new StringTokenizer("02-08-1983","-");
while(st.hasMoreTokens())
{
System.out.println(st.nextToken());
}

The output will be:
02
08
1983

Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology
Call to: 9439202111  |  9658317757  |  0674-2361252

Comment