Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

double to float

Status
Not open for further replies.

Alastor

MIS
Aug 27, 1998
36
US
I'm trying to convert a double value to a float value using the floatValue() method. When I compile I keep getting the error - Method floatValue(double) not found in class. I've tried adding Import java.lang.Number.* but I get the same error. What am I doing wrong?
 
Hi.<br>
<br>
I just looked up type casting my java book. Which is what I think you want to do. something like <br>
<br>
floatVal=(float)doubleVal;<br>
<br>
Should do the trick. I remember from practice that sometimes javac doesn't like some casting but give it a go.<br>
<br>
The book i've got is "Java software solutions"-Lewis & Loftus. It's really good but it's on JDK 1.6 there probably is a new edition for 2.0 around.
 
Just read the legal thing that came when I signed up. Sorry sorry sorry. I am in no way affiliated with the publishers or authors of this book. In fact its a good idea to go into you local college/university/other training institiude witha good library and take some time to read through the guides and take some notes. It's a lot chaper that way and you only get what you need.
 
Thanks for the info. The type casting was what I needed. I'll check out that book, but I won't tell anyone that you told me about it ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top