Explain Stream Tokenizer?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by object?

580


What is the escape character in java?

553


What is collection sort in java?

591


What are the main differences between the java platform and other platforms?

558


What is final keyword in java?

589






What is an enumeration?

599


Explain the use of javap tool.

662


How to print an arraylist in java?

536


What is the difference between serial and throughput garbage collector?

612


Is linked list a linear or non-linear data structure?

581


Which number is denoted by leading 0x or 0x in java?

607


What is currentthread()?

607


What is the type of lambda expression?

576


Can arraylist hold different types java?

525


What is the difference between an interface and an abstract class?

575