File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String.. 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 "String.." Watch "String.." New topic


Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
could anyone let me know how to check whether the string is an integer?
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
If the String doesn't represent an integer, the method will throw a NumberFormatException. Otherwise, it returns the value of the int. Similar methods exist in the other numeric wrapper classes as well - Float, Double, Long, etc.

"I'm not back." - Bill Harding, Twister
jQuery in Action, 3rd edition
subject: String..
It's not a secret anymore!