This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Sacnner Issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Sacnner Issues" Watch "Sacnner Issues" New topic
Author

Sacnner Issues

Ishan Pandya
Ranch Hand

Joined: Feb 06, 2012
Posts: 225

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).


OCPJP
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

You need to be aware of the fact that a token is a single word ( without space delimiters ) .



Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Ishan Pandya
Ranch Hand

Joined: Feb 06, 2012
Posts: 225

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

Joined: Oct 13, 2005
Posts: 43905
    
  33
No. You should not use string tokenizer at all. If that is the input, you will need to change the delimiter on your Scanner.
 
Have you checked out Aspose?
 
subject: Sacnner Issues
 
It's not a secret anymore!