|
|
Start of Tutorial > Start of Trail > Start of Lesson | Search |
TheStringclass itself does not provide any methods for converting aStringto a floating point, integer, or other numerical type. However, four of the "type wrapper" classes (Integer,Double,Float, andLong) provide a class method namedvalueOfthat converts aStringto an object of that type. Here's a small, contrived example of theFloatclass'svalueOf:String piStr = "3.14159"; Float pi = Float.valueOf(piStr);
|
|
Start of Tutorial > Start of Trail > Start of Lesson | Search |