Convert a String to int



The first and fastest way to convert a String to an integer value is to use the static method valueOf() of the Integer class. The valueOf() method can be used by other primitive wrapper classes too to convert between different types.

Another way is to use the static method parseInt of the Integer class to convert
a String to an int as below:

Alternatively you can pass a String to the Integer class constructor
and call the intValue() method of the object:







Search for more Java info on this site here:
Custom Search


Please type any questions here.