This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Problem using StringTokenizer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem using StringTokenizer" Watch "Problem using StringTokenizer" New topic
Author

Problem using StringTokenizer

Ankur Premi
Greenhorn

Joined: Aug 07, 2010
Posts: 17
I am trying to use StringTokenizer for saving the value of val (See code below) in different variables.

I have written this code. But this code is returning null values. It's not saving the value of val corresponding to the key.





Please help me.
Vinoth Kumar Kannan
Ranch Hand

Joined: Aug 19, 2009
Posts: 276

I suppose, it wont even enter the three if statements. How did you decide it gives null values?
Use equals() to compare the contents of 2 strings.'==' is used to check reference equality.


OCPJP 6
Ankur Premi
Greenhorn

Joined: Aug 07, 2010
Posts: 17
thank you vinoth. it worked
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38467
    
  23
Ankur Premi wrote:I am trying to use StringTokenizer . . .
Why? It is a legacy class.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem using StringTokenizer