what is stringtolennizer with example?

Answers were Sorted based on User's Feedback



what is stringtolennizer with example?..

Answer / 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

what is stringtolennizer with example?..

Answer / shahnawaz sheikh

StringTokeniser is a utility that helps to seperate a
complex combination of string into simpler one usually
array.

Ex a string: Name$abc;EmpCode$02335;Sex$Male

can be simple broken into
Name abc
EmpCode 02335
Sex Male

NO matter how long the occurence be.

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Core Java Interview Questions

what is use of marker interface? give me good example?

2 Answers  


Can substring create new object?

0 Answers  


Is space a char?

0 Answers  


What are the override methods in Object class?

2 Answers   Tech Mahindra, Wipro,


Can we access a database using applets?

2 Answers   Hewitt,






What is the difference between array and array list in java?

0 Answers  


Which methods cannot be overridden in java?

0 Answers  


Compare java and python.

0 Answers  


How many types of exception can occur in a java program?

0 Answers  


What are interfaces?

3 Answers  


What are the different types of inheritance in java?

0 Answers  


using equals method overriding which objects are compared?i.e same class objects or other class objects?Explain me.

4 Answers  


Categories