Current Forum: Homework 1 Forum |
Date: Sat Sep 8 2001 10:44 am |
Author: Scherer, Sebastian <sebastian.scherer@cs.cmu.edu> |
Subject: Re: float to Float |
|
|
Hi! Maybe you confused the static method toString(float x) with the dynamic object method toString() .(That is the danger of overloading functions.) You can use the static methods of Float just as you can use any library. You don't have initialize anything, but when you want to use an object you have to create an instance of it by calling its instructor. After that in a object variable your whole object is stored and you access its values through the object methods like toString() for example. Two ways to convert a float value to a String:
float t = 12; String x = new String(Float.toString(t));
The second way by creating a float object:
Float o = new Float(12); String x = new String(o.toString());
I hope this helps
Sebastian
|
|