Answer Posted / eva
The string tokenizer class allows an application to break a string into tokens
The set of delimiters (the characters that separate tokens) may be specified either at creation time or on a per-token basis.
An instance of StringTokenizer behaves in one of two ways, depending on whether it was created with the returnDelims flag having the value true or false:
If the flag is false, delimiter characters serve to separate tokens. A token is a maximal sequence of consecutive characters that are not delimiters.
If the flag is true, delimiter characters are themselves considered to be tokens. A token is thus either one delimiter character, or a maximal sequence of consecutive characters that are not delimiters.
Example:
StringTokenizer st = new StringTokenizer("this is a test");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
}
prints the following output:
this
is
a
test
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is module in project?
What is exception handling in java?
What are Normalization Rules? Define Normalization?
How many types of memory areas are allocated by JVM in java?
Explain about member inner classes?
List the interfaces which extends collection interface?
What is the use of a copy constructor?
Can we serialize singleton class?
What do you mean by constant time complexity?
What are the differences between wait() and sleep()?
How java enabled high performance?
When should you make a function static?
Can we use this () and super () in a method?
What is the difference between class forname and new?
Can we have multiple public classes in a java source file?