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 super in java?
What are the rules for naming an array?
What is the loop in java?
how to write a program for sending mails between client and server
Explain the use of shift operator in java. Can you give some examples?
What are the topics in core java?
What is javac in java?
What is integer valueof?
Why Java is not pure Object Oriented language?
State the merge-sort principle and its time complexity.
What programs use java?
What is the difference between integer parseint and integer valueof?
What is meant by method?
What does %d do in java?
Is a case study a method or methodology?