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 are the steps in the jdbc connection?
What is meant by overloading?
What is string literal in java?
What is garbage collection? Can it be forced to run?
what is the purpose of "virtual"?
What is * argv?
can I implement my own start() method? : Java thread
What is the difference between ArrayList and Vector? which one is better in Java
What is oop principle in java?
How to check if linked list contains loop in java?
How do you identify independent and dependent variables?
What are three ways in which a thread can enter the waiting state in java programming?
Why there is no call by reference in java?
What is the largest number a double can hold?
What is the difference between double and float variables in java?