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 public static void main?
How to find the given number is a prime number or not by getting input from the user
explain multi-threading in java?
What is immutable in java?
Explain importance of finally block in java?
Are constructors methods?
Is map ordered in java?
What is the base class of all exception classes?
When should I use singleton pattern?
Explain the importance of throws keyword in java?
Why does abstract class have constructor?
What is singleton class example?
How is java hashmap implemented?
What should I import for arraylist in java?
Addition to previous section relative word 5th one was Putrid ans: rotten, also there was prob. in 1st section on bucket weight ans:10kg, also there was a prob. on train speed to find bridge length ans:800 mtrs.