Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem using StringTokenizer

 
Ankur Premi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 276
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ankur Premi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you vinoth. it worked
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankur Premi wrote:I am trying to use StringTokenizer . . .
Why? It is a legacy class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic