This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread 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 Android Security Essentials Live Lessons this week in the Android 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: 38064
    
  22
Ankur Premi wrote:I am trying to use StringTokenizer . . .
Why? It is a legacy class.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem using StringTokenizer
 
Similar Threads
Tokenizing after reading from a file
please help with tokenizing
File Operations Program Problem
exercise getServiceByName
How to search a Vector array?