 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to split a Java String into tokens with StringTokenizer?
The hasMoreTokens() method is used to test if there are more tokens available from this tokenizer's string.
Example
import java.util.*; public class StringTokenizerDemo {    public static void main(String[] args) {       // creating string tokenizer       StringTokenizer st = new StringTokenizer("Come to learn");       // checking elements       while (st.hasMoreElements()) {          System.out.println("Next element : " + st.nextElement());       }    } }  Output
Next element : Come Next element : to Next element : learn
Advertisements
 