wood burning stoves*
The moose likes Beginning Java and the fly likes Using parseFloat with JDK 1.1.8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Using parseFloat with JDK 1.1.8" Watch "Using parseFloat with JDK 1.1.8" New topic
Author

Using parseFloat with JDK 1.1.8

Suresh Kanagalingam
Ranch Hand

Joined: Aug 17, 2001
Posts: 82
Hello,
I am using JDK 1.1.8 (I can not update to new version because of another software dependancy).
When I tried to use the line below:
updateTable.setFloat (1, Float.parseFloat(fieldList.nextToken()));
I am getting "Method parseFloat(java.lang.String) not found in class java.lang.Float"
Should I import another package? Or 1.1.8 does not have this method?
Thanks
Suresh
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
You should always check the API for the JDK you're using. In this case, try
Float.valueOf(input).floatValue()
Obviously this was a rather backwards way of getting what you want, so they added parseFloat() in later versions of the JDK.


"I'm not back." - Bill Harding, Twister
Suresh Kanagalingam
Ranch Hand

Joined: Aug 17, 2001
Posts: 82
Thanks Jim.
Works fine.
Suresh
 
 
subject: Using parseFloat with JDK 1.1.8
 
Similar Threads
How to convert a string to a float or double?
Double trouble
copying files in jdk 1.1.8
Basic Error But Where Do I go Wrong
trouble with JavaScript division