aspose file tools*
The moose likes Beginning Java and the fly likes Cast a String to a long? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cast a String to a long?" Watch "Cast a String to a long?" New topic
Author

Cast a String to a long?

Michael Brewer
Ranch Hand

Joined: Jun 27, 2002
Posts: 54
Is it possible to cast a String to a long? I first looked for String methods that would allow me to do this, and then I tried doing this:

That gives me an 'inconvertible types' error.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Michael
Check out the parseLong() method in the Long class. It takes a String arguemnt and returns a long (primitive).


Dave
 
Consider Paul's rocket mass heater.
 
subject: Cast a String to a long?