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
List some important characteristics on jre
Explain the difference between collection api and stream api in java8?
Explain access modifiers in java.
What are thread priorities and importance of thread priorities in java?
What are the 4 types of research methods?
What is OOP's Terms with explanation?
How use .contains in java?
What is the difference between jdk and jre?
What function extracts specified characters from a string?
What is the map interface in java programming?
What is the biggest integer?
How can an object be unreferenced?
what is the difference between a threads start() and run() methods? : Java thread
What are the uses of synchronized keyword?
What are measurable parameters?