728x90
반응형
parseInt
public static int parseInt(String s) throws NumberFormatException
- Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign
'-'
('\u002D'
) to indicate a negative value. The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to theparseInt(java.lang.String, int)
method. - Parameters:
s
- aString
containing theint
representation to be parsed- Returns:
- the integer value represented by the argument in decimal.
- Throws:
NumberFormatException
- if the string does not contain a parsable integer.
___________________________________________________________________________
valueOf
public static Integer valueOf(String s) throws NumberFormatException
- Returns an
Integer
object holding the value of the specifiedString
. The argument is interpreted as representing a signed decimal integer, exactly as if the argument were given to theparseInt(java.lang.String)
method. The result is anInteger
object that represents the integer value specified by the string.In other words, this method returns an
Integer
object equal to the value of:new Integer(Integer.parseInt(s))
- Parameters:
s
- the string to be parsed.- Returns:
- an
Integer
object holding the value represented by the string argument. - Throws:
NumberFormatException
- if the string cannot be parsed as an integer.
반응형
'Development > Java' 카테고리의 다른 글
Unable to load default SVN Client 발생 시. (0) | 2014.11.10 |
---|---|
call by reference vs call by pointer. (0) | 2014.02.12 |
댓글