Java Reference
In-Depth Information
Converts the string
str
to a value of the specified primitive
type
. For example,
Integer.parseInt("10")
returns the value
10. This is equivalent to invoking the string-converting con-
structor, and extracting the resulting value with
type
Value()
,
but without constructing an object.
Character
does not have
this method just as it does not have the string-converting
constructor.
public static String
toString(
type
val)
Returns a string representation of the given primitive value
of type
type
. For example,
Double.toString(0.3e2)
returns the
string
"30.0"
.
All wrapper classes have these methods so we do not list them in each
class's description. The wrapper class's system property fetch-and-de-
code methods, described in "
System Properties
" on page
663
, are not
discussed in this chapter.