It's not a secret anymore!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How to convert from String to Integer? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How to convert from String to Integer?" Watch "How to convert from String to Integer?" New topic
Author

How to convert from String to Integer?

qionghua yang
Ranch Hand

Joined: Oct 31, 2000
Posts: 68
Hi there,
I have this String "12" and I would like to have an Integer. Is there any easy way to cast or convert it to an Integer? Thanks!
qionghua
Peter Tran
Bartender

Joined: Jan 02, 2001
Posts: 783
Use Integer.parseInt("12").
-Peter
qionghua yang
Ranch Hand

Joined: Oct 31, 2000
Posts: 68
Hi Peter,
It works. Thanks a lot!
qionghua
 
GeeCON Prague 2014
 
subject: How to convert from String to Integer?