Explain Stream Tokenizer?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between jvm and jre?

790


What is var keyword ?

927


What is static and final keyword in java?

779


Why do we need wrapper class?

741


What is the difference between inheritance and encapsulation?

857


What is passing by reference in java?

772


What are some alternatives to inheritance?

822


Is java owned by oracle?

766


What is a numeric format?

786


How do you declare a string variable?

748


Explain about the security aspect of java?

771


Why generics are used in java?

775


When should I use singleton?

703


Can a variable be local and static at the same time?

768


Can we extend a class with private constructor?

731