- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the significance of the StringTokenizer class of the Java? Explain with an example?
The java.util.StringTokenizer class allows an application to break a string into tokens.
This class is a legacy class that is retained for compatibility reasons although its use is discouraged in new code.
Its methods do not distinguish among identifiers, numbers, and quoted strings.
This class methods do not even recognize and skip comments.
Example
import java.util.*; public class StringTokenizerDemo { public static void main(String[] args) { // creating string tokenizer StringTokenizer st = new StringTokenizer("Tutorialspoint is the best site"); // counting tokens System.out.println("Total tokens : " + st.countTokens()); } }
Output
Total tokens : 5
- Related Articles
- (a) What is the significance of the symbol of an element? Explain with the help of an example.(b) Explain the significance of the symbol H.
- What is the use of StringBuffer class can anyone explain with an example?
- Constructors of StringTokenizer class in Java.
- Methods of StringTokenizer class in Java.
- What is symbiotic relationship? Explain with the help of an example
- What is the purpose of COALESCE function? Explain with the help of an example.
- What is the character count? Explain with an example?
- StringTokenizer class in Java
- What is Inheritance in Java? Explain with an example
- Explain the division of integers with an example.
- What is the ten percent law? Explain with an example.
- How can we use the StringTokenizer class in Java?
- (a) What is meant by a contact force? Explain with the help of an example.(b) What is meant by a non-contact force? Explain with the help of an example.
- What is shallow copy? Explain with an example in Java.
- What is deep copy? Explain with an example in Java.

Advertisements