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
Is java ee a framework?
What is use of static method?
Is minecraft java edition free?
What is json parser in java?
What is the use of volatile in java?
What is defined as false sharing in the context of multithreading?
Explain the Propertie sof class?
What is the base class of all exception classes in java?
What is oop in java?
What are the types of methods in java?
Define how does a try statement determine which catch clause should be used to handle an exception?
What is the use of set in java?
What is the static field modifier?
What is Java Annotations?
What is ide with example?