Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
TheString
class itself does not provide any methods for converting aString
to a floating point, integer, or other numerical type. However, four of the "type wrapper" classes (Integer
,Double
,Float
, andLong
) provide a class method namedvalueOf
that converts aString
to an object of that type. Here's a small, contrived example of theFloat
class'svalueOf
:String piStr = "3.14159"; Float pi = Float.valueOf(piStr);
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved.