Singh M.
Posts: 154
Nickname: ms
Registered: Mar, 2002
|
|
Re: Converting a float to object
|
Posted: Apr 17, 2003 6:50 PM
|
|
> Ok so I know a float is an object. My problem is that I > have a method which im using from another class which only > writes objects to a file which im using. In my particular > program, I add two floats and then I need to write the > answer out to the file using a method > writeObject(Object args) . How do I get round > this supposedly easy problem?
float is not an object, Float is.
convert your float into Float as follows...
Float obj = new Float(f); // where f is of type float.
and pass obj to the concerned method.
or
pass them to writeObject as follows...
writeObject(String.valueOf(f));
|
|