Explain Stream Tokenizer?
Answers were Sorted based on User's Feedback
Answer / qim2010
The StreamTokenizer class can tokenizer a Reader into
tokens. For instance, in the string "Mary had a little lamb"
each word is a separate token.
We need to move through the tokens in the underlying Reader
by calling the nextToken() method in a loop. After each
call to nextToken() the StreamTokenizer has several fields
you can read to see what kind of token was read, it's value
etc. These fields are:
ttype The type of token read (word, number, end of line)
sval The string value of the token, if the token was a
string (word)
nval The number value of the token, if the token was a
number.
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / srinu
Stream Tokenizer from java.util package this class
implements Enumeration interface.This class break the string
into tokens with take parameter as delimeter
EX:-
import java.util.*;
public class Strtok
{
public static void main(String [] args)
{
String Demo = "This is a string that we want to tokenize";
StringTokenizer Tok = new StringTokenizer(Demo);
int n=0;
while (Tok.hasMoreElements())
System.out.println("" + ++n +": "+Tok.nextElement());
}
}
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / ravikiran(aptech mumbai)
StringTokenizer is a class of java.util package.
It's main purpose is to break the string into tokens with
reference to a delimeter
Is This Answer Correct ? | 0 Yes | 3 No |
What are variable arguments or varargs?
What's the difference between comparison done by equals method and == operator?
When should we create our own custom exception classes?
worst case complexities of Quick sort and Merge sort.
system.out.println(1 + 3);
How do you detect memory leaks?
What is hasnext in java?
What is xslt in java?
Does anyone still use java?
What is the USE of Null interfaces ??...if thers nothing inside these interfaces how are they used and WHy are they used ???? No 1 has given a proper description yet
what is domain object
use of wrapper classes?