Share via


Integer.valueOf

Class Overview | Class Members | This Package | All Packages

Syntax 1

public static Integer valueOf( String s**, int** radix ) throws NumberFormatException

Parameters
  • s
    the string to be parsed.
Returns

a newly constructed Integer initialized to the value represented by the string argument in the specified radix.

Description

Returns a new Integer object initialized to the value of the specified String. Throws an exception if the String cannot be parsed as an int.

Exceptions

NumberFormatException if the String does not contain a parsable integer.

Syntax 2

public static Integer valueOf( String s ) throws NumberFormatException

Parameters
  • s
    the string to be parsed.
Returns

a newly constructed Integer initialized to the value represented by the string argument.

Description

Returns a new Integer object initialized to the value of the specified String. Throws an exception if the String cannot be parsed as an int. The radix is assumed to be 10.

Exceptions

NumberFormatException if the string does not contain a parsable integer.