Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sacnner Issues

 
Ishan Pandya
Ranch Hand
Posts: 226
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiee everyone..!!
I am using Scanner Class for separating the tokens.
Here is the code.



I want the Integer value from the String defined in the class. But i am not getting any output (i.e the output is blank and I am expecting 101 as output).
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to be aware of the fact that a token is a single word ( without space delimiters ) .

 
Ishan Pandya
Ranch Hand
Posts: 226
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saif Asif wrote:You need to be aware of the fact that a token is a single word ( without space delimiters ) .


So you mean I have to use StringTokenizer instead of Scanner?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You should not use string tokenizer at all. If that is the input, you will need to change the delimiter on your Scanner.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic