Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

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

About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.


We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc






 PreviousNext